]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxButton.py
A few little tweaks
[wxWidgets.git] / wxPython / demo / wxButton.py
1
2 from wxPython.wx import *
3
4 import images
5
6 #----------------------------------------------------------------------
7
8 class TestPanel(wxPanel):
9 def __init__(self, parent, log):
10 wxPanel.__init__(self, parent, -1)
11 self.log = log
12
13 b = wxButton(self, 10, "Hello", wxPoint(20, 20))
14 EVT_BUTTON(self, 10, self.OnClick)
15 b.SetBackgroundColour(wxBLUE)
16 b.SetForegroundColour(wxWHITE)
17 b.SetDefault()
18
19 b = wxButton(self, 20, "HELLO AGAIN!", wxPoint(20, 60), wxSize(120, 45))
20 EVT_BUTTON(self, 20, self.OnClick)
21
22 b.SetToolTipString("This is a Hello button...")
23
24 bmp = images.getTest2Bitmap()
25 mask = wxMaskColour(bmp, wxBLUE)
26 bmp.SetMask(mask)
27
28 wxBitmapButton(self, 30, bmp, wxPoint(160, 20),
29 wxSize(bmp.GetWidth()+10, bmp.GetHeight()+10))
30 EVT_BUTTON(self, 30, self.OnClick)
31
32 def OnClick(self, event):
33 self.log.WriteText("Click! (%d)\n" % event.GetId())
34
35
36 #----------------------------------------------------------------------
37
38 def runTest(frame, nb, log):
39 win = TestPanel(nb, log)
40 return win
41
42 #----------------------------------------------------------------------
43
44
45
46
47
48
49
50
51
52
53 overview = """\
54 """
55
56