]> git.saurik.com Git - wxWidgets.git/blob - wxPython/samples/wxPIA_book/Chapter-07/bitmap_button.py
don't use strlen() to verify the length of the string as it can contain embedded...
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-07 / bitmap_button.py
1 import wx
2
3 class BitmapButtonFrame(wx.Frame):
4 def __init__(self):
5 wx.Frame.__init__(self, None, -1, 'Bitmap Button Example',
6 size=(200, 150))
7 panel = wx.Panel(self, -1)
8 bmp = wx.Image("bitmap.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
9 self.button = wx.BitmapButton(panel, -1, bmp, pos=(10, 20))
10 self.Bind(wx.EVT_BUTTON, self.OnClick, self.button)
11 self.button.SetDefault()
12 self.button2 = wx.BitmapButton(panel, -1, bmp, pos=(100, 20),
13 style=0)
14 self.Bind(wx.EVT_BUTTON, self.OnClick, self.button2)
15
16 def OnClick(self, event):
17 self.Destroy()
18
19 if __name__ == '__main__':
20 app = wx.PySimpleApp()
21 frame = BitmapButtonFrame()
22 frame.Show()
23 app.MainLoop()
24
25