]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxButton.py
2 from wxPython
.wx
import *
4 #----------------------------------------------------------------------
6 class TestPanel(wxPanel
):
7 def __init__(self
, parent
, log
):
8 wxPanel
.__init
__(self
, parent
, -1)
11 b
= wxButton(self
, 10, "Hello", wxPoint(20, 20))
12 EVT_BUTTON(self
, 10, self
.OnClick
)
13 b
.SetBackgroundColour(wxBLUE
)
14 b
.SetForegroundColour(wxWHITE
)
17 b
= wxButton(self
, 20, "HELLO AGAIN!", wxPoint(20, 60), wxSize(90, 45))
18 EVT_BUTTON(self
, 20, self
.OnClick
)
20 b
.SetToolTipString("This is a Hello button...")
22 bmp
= wxBitmap('bitmaps/test2.bmp', wxBITMAP_TYPE_BMP
)
24 mask
= wxMaskColour(bmp
, wxBLUE
)
27 print bmp
.GetWidth(), bmp
.GetHeight()
29 wxBitmapButton(self
, 30, bmp
, wxPoint(140, 20),
30 wxSize(bmp
.GetWidth()+10, bmp
.GetHeight()+10))
31 EVT_BUTTON(self
, 30, self
.OnClick
)
34 def OnClick(self
, event
):
35 self
.log
.WriteText("Click! (%d)\n" % event
.GetId())
38 #----------------------------------------------------------------------
40 def runTest(frame
, nb
, log
):
41 win
= TestPanel(nb
, log
)
44 #----------------------------------------------------------------------