]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxButton.py
Applied and merged patch 486364, which enables wxPython to be built in
[wxWidgets.git] / wxPython / demo / wxButton.py
CommitLineData
cf694132
RD
1
2from wxPython.wx import *
3
96bfd053
RD
4import images
5
cf694132
RD
6#----------------------------------------------------------------------
7
8class TestPanel(wxPanel):
9 def __init__(self, parent, log):
10 wxPanel.__init__(self, parent, -1)
11 self.log = log
12
5ed3dab2 13 b = wxButton(self, 10, "Hello", wxPoint(20, 20))
cf694132 14 EVT_BUTTON(self, 10, self.OnClick)
5ed3dab2
RD
15 b.SetBackgroundColour(wxBLUE)
16 b.SetForegroundColour(wxWHITE)
9b3d3bc4 17 b.SetDefault()
cf694132 18
185d7c3e 19 b = wxButton(self, 20, "HELLO AGAIN!", wxPoint(20, 60), wxSize(90, 45))
cf694132
RD
20 EVT_BUTTON(self, 20, self.OnClick)
21
185d7c3e
RD
22 b.SetToolTipString("This is a Hello button...")
23
96bfd053 24 bmp = images.getTest2Bitmap()
990416e0
RD
25 mask = wxMaskColour(bmp, wxBLUE)
26 bmp.SetMask(mask)
eec92d76 27
76bfdc78 28 ##print bmp.GetWidth(), bmp.GetHeight()
4c9993c3 29
cf694132
RD
30 wxBitmapButton(self, 30, bmp, wxPoint(140, 20),
31 wxSize(bmp.GetWidth()+10, bmp.GetHeight()+10))
32 EVT_BUTTON(self, 30, self.OnClick)
33
34
35 def OnClick(self, event):
36 self.log.WriteText("Click! (%d)\n" % event.GetId())
37
064f8bf6 38
cf694132
RD
39#----------------------------------------------------------------------
40
41def runTest(frame, nb, log):
42 win = TestPanel(nb, log)
43 return win
44
45#----------------------------------------------------------------------
46
47
48
49
50
51
52
53
54
55
56overview = """\
57"""
58
59