Hey all, had another question that came up in my first Python program. The program is pretty much just a GUI for an application launcher. My current version has rollover buttons and successfully launches the applications, but is bloated and needs some revision so I'll post the first version with the problem.
import wx class Panel1(wx.Panel): """class Panel1 creates a panel with an image on it, inherits wx.Panel""" def __init__(self, parent, id): # Create the panel wx.Panel.__init__(self, parent, id) try: # Load image into variables image_file = 'Background.jpg' bmp1 = wx.Image(image_file, wx.BITMAP_TYPE_ANY).ConvertToBitmap() # Place the bitmap (background) self.bitmap1 = wx.StaticBitmap(self, -1, bmp1, (0, 0)) # Close program if image is missing except IOError: print "Image file %s not found" % imageFile raise SystemExit # Create BMP Button imageFile1 = "Normal01.jpg" image1 = wx.Image(imageFile1, wx.BITMAP_TYPE_ANY).ConvertToBitmap() self.button1 = wx.BitmapButton(self.bitmap1, id=-1, bitmap = image1, pos=(74, 75), size = (102, 55)) app = wx.PySimpleApp() # Create a window/frame, no parent, -1 is default ID # Change the size of the frame to fit the backgound images frame1 = wx.Frame(None, -1, "Launch a program", size=(600, 234)) # Create the class instance panel1 = Panel1(frame1, -1) frame1.Show(True) app.MainLoop()
My problem is that the buttons flicker occasionally on mouseover. I read something about this occurring when the back panel is painted with a painted button over it, but the post was either too advanced for me or unrelated and I couldn't find the solution. My question is how do I fix this flicker?
I'll attach the two images needed to crate the program if anyone wants to test it out and see it for themselves. The launcherpiczg8 is a screen shot of the nearly done version with rollover. When I get some more free time again I'll probably rewrite it with what I've learned on the way and make the last version postable (currently bloated and inefficient).
And another thing, how would I remove the outside frame? I saw advice from vegaseat on how to do it, but I couldn't get it to work. What would I have to do to my code to remove the frame?