]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxButton.py
Added scripts to make Tex2RTF distribution on Unix
[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 style=wxNO_FULL_REPAINT_ON_RESIZE)
12 self.log = log
13
14 b = wxButton(self, 10, "Hello", wxPoint(20, 20))
15 EVT_BUTTON(self, 10, self.OnClick)
16 b.SetBackgroundColour(wxBLUE)
17 b.SetForegroundColour(wxWHITE)
18 b.SetDefault()
19
20 b = wxButton(self, 20, "HELLO AGAIN!", wxPoint(20, 60), wxSize(120, 45))
21 EVT_BUTTON(self, 20, self.OnClick)
22
23 b.SetToolTipString("This is a Hello button...")
24
25 bmp = images.getTest2Bitmap()
26 mask = wxMaskColour(bmp, wxBLUE)
27 bmp.SetMask(mask)
28
29 wxBitmapButton(self, 30, bmp, wxPoint(160, 20),
30 wxSize(bmp.GetWidth()+10, bmp.GetHeight()+10))
31 EVT_BUTTON(self, 30, self.OnClick)
32
33 def OnClick(self, event):
34 self.log.WriteText("Click! (%d)\n" % event.GetId())
35
36
37 #----------------------------------------------------------------------
38
39 def runTest(frame, nb, log):
40 win = TestPanel(nb, log)
41 return win
42
43 #----------------------------------------------------------------------
44
45
46
47
48
49
50
51
52
53
54 overview = """\
55 """
56
57