Problem with BitmapButton
Hi Guys, I don't know if someone can help me but I've an issue with wx.BitMapButton
My buttons are not clickable.
He's my code
self.imageFileDownload = 'StatusDownload.gif'
self.gif1 = wx.Image(self.imageFileDownload, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# bitmap upper left corner is in the position tuple (x, y) = (5, 5)
self.btnstatus = wx.BitmapButton(self, -1, self.gif1, (420 + self.gif1.GetWidth(), 300), (32, 32), style = wx.NO_BORDER)
self.btnstatus.Bind(wx.EVT_BUTTON, self.OnDownload)
self.imageFileDownload = './download.jpg'
self.gif1 = wx.Image(self.imageFileDownload, wx.BITMAP_TYPE_ANY).ConvertToBitmap()
# bitmap upper left corner is in the position tuple (x, y) = (5, 5)
self.btndownload = wx.BitmapButton(self, -1, self.gif1, (445 + self.gif1.GetWidth(), 300), (32, 32),wx.BU_AUTODRAW)
self.btndownload.Bind(wx.EVT_BUTTON, self.OnDownload)
self.btndownload.Enable()
self.btndownload.SetDefault()
def OnDownload(self, event):
status="coucou"
print status
Re: Problem with BitmapButton
Quote:
Originally Posted by
Gotcha007
self.btnstatus = wx.BitmapButton(self, -1, self.gif1, (420 + self.gif1.GetWidth(), 300), (32, 32), style = wx.NO_BORDER)
Maybe, instead of self.gif1 and the two lines of code before that, put, "self.btnstatus = wx.BitmapButton(self, -1, wx.Bitmap('file location and name')" and then the other stuff. That works for me in my first program(newbie I is) and my button images are jpg.