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