CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2011
    Posts
    0

    Question 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

  2. #2
    Join Date
    Mar 2011
    Posts
    2

    Re: Problem with BitmapButton

    Quote Originally Posted by Gotcha007 View Post
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured