]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/Button.py
wxCheckListBox doesn't require wxUSE_OWNER_DRAWN when using WXUNIVERSAL
[wxWidgets.git] / wxPython / demo / Button.py
1
2 import wx
3
4 #----------------------------------------------------------------------
5
6 class TestPanel(wx.Panel):
7 def __init__(self, parent, log):
8 wx.Panel.__init__(self, parent, -1,
9 style=wx.NO_FULL_REPAINT_ON_RESIZE)
10 self.log = log
11
12 b = wx.Button(self, 10, "Default Button", (20, 20))
13 self.Bind(wx.EVT_BUTTON, self.OnClick, b)
14 b.SetDefault()
15 b.SetSize(b.GetBestSize())
16
17 b = wx.Button(self, 20, "HELLO AGAIN!", (20, 80)) ##, (120, 45))
18 self.Bind(wx.EVT_BUTTON, self.OnClick, b)
19 b.SetToolTipString("This is a Hello button...")
20
21 b = wx.Button(self, 40, "Flat Button?", (20,150), style=wx.NO_BORDER)
22 b.SetToolTipString("This button has a style flag of wx.NO_BORDER. On some platforms that will give it a flattened look.")
23 self.Bind(wx.EVT_BUTTON, self.OnClick, b)
24
25
26 def OnClick(self, event):
27 self.log.write("Click! (%d)\n" % event.GetId())
28
29 #----------------------------------------------------------------------
30
31 def runTest(frame, nb, log):
32 win = TestPanel(nb, log)
33 return win
34
35 #----------------------------------------------------------------------
36
37
38 overview = """<html><body>
39 <h2>Button</h2>
40
41 A button is a control that contains a text string or a bitmap and can be
42 placed on nearly any kind of window.
43
44 </body></html>
45 """
46
47
48
49 if __name__ == '__main__':
50 import sys,os
51 import run
52 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
53