]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/samples/wxPIA_book/Chapter-07/bitmap_button.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / samples / wxPIA_book / Chapter-07 / bitmap_button.py
... / ...
CommitLineData
1import wx
2
3class 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
19if __name__ == '__main__':
20 app = wx.PySimpleApp()
21 frame = BitmapButtonFrame()
22 frame.Show()
23 app.MainLoop()
24
25