]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/CheckBox.py
Don't bind events to the return value of SetDefault, D'oh!
[wxWidgets.git] / wxPython / demo / CheckBox.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
4#---------------------------------------------------------------------------
5
8fa876ca 6class TestCheckBox(wx.Panel):
cf694132
RD
7 def __init__(self, parent, log):
8 self.log = log
8fa876ca 9 wx.Panel.__init__(self, parent, -1)
cf694132 10
8fa876ca 11 wx.StaticText(self, -1, "This example uses the wxCheckBox control.", (10, 10))
cf694132 12
95bfd958
RD
13 cb1 = wx.CheckBox(self, -1, " Apples", (65, 40), (150, 20), wx.NO_BORDER)
14 cb2 = wx.CheckBox(self, -1, " Oranges", (65, 60), (150, 20), wx.NO_BORDER)
1e4a197e 15 cb2.SetValue(True)
95bfd958 16 cb3 = wx.CheckBox(self, -1, " Pears", (65, 80), (150, 20), wx.NO_BORDER)
cf694132 17
8fa876ca
RD
18 self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb1)
19 self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb2)
20 self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb3)
cf694132
RD
21
22 def EvtCheckBox(self, event):
d14a1e28 23 self.log.WriteText('EvtCheckBox: %d\n' % event.IsChecked())
cf694132
RD
24
25#---------------------------------------------------------------------------
26
27def runTest(frame, nb, log):
28 win = TestCheckBox(nb, log)
29 return win
30
31#---------------------------------------------------------------------------
32
33
cf694132 34overview = """\
95bfd958
RD
35A checkbox is a labelled box which is either on (checkmark is visible) or off
36(no checkmark).
cf694132 37
cf694132 38"""
1fded56b 39
95bfd958 40#---------------------------------------------------------------------------
1fded56b
RD
41
42if __name__ == '__main__':
43 import sys,os
44 import run
8eca4fef 45 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
1fded56b 46