Added the sample code from wxPython In Action to the samples dir
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
25
wxPython/samples/wxPIA_book/Chapter-07/bitmap_button.py
Normal file
25
wxPython/samples/wxPIA_book/Chapter-07/bitmap_button.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import wx
|
||||
|
||||
class BitmapButtonFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Bitmap Button Example',
|
||||
size=(200, 150))
|
||||
panel = wx.Panel(self, -1)
|
||||
bmp = wx.Image("bitmap.bmp", wx.BITMAP_TYPE_BMP).ConvertToBitmap()
|
||||
self.button = wx.BitmapButton(panel, -1, bmp, pos=(10, 20))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnClick, self.button)
|
||||
self.button.SetDefault()
|
||||
self.button2 = wx.BitmapButton(panel, -1, bmp, pos=(100, 20),
|
||||
style=0)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnClick, self.button2)
|
||||
|
||||
def OnClick(self, event):
|
||||
self.Destroy()
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = wx.PySimpleApp()
|
||||
frame = BitmapButtonFrame()
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
Reference in New Issue
Block a user