]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/CheckBox.py
update from herbert breunung
[wxWidgets.git] / wxPython / demo / CheckBox.py
... / ...
CommitLineData
1
2import wx
3
4#---------------------------------------------------------------------------
5
6class TestCheckBox(wx.Panel):
7 def __init__(self, parent, log):
8 self.log = log
9 wx.Panel.__init__(self, parent, -1)
10
11 wx.StaticText(self, -1, "This example uses the wxCheckBox control.", (10, 10))
12
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)
15 cb2.SetValue(True)
16 cb3 = wx.CheckBox(self, -1, " Pears", (65, 80), (150, 20), wx.NO_BORDER)
17
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)
21
22 def EvtCheckBox(self, event):
23 self.log.WriteText('EvtCheckBox: %d\n' % event.IsChecked())
24
25#---------------------------------------------------------------------------
26
27def runTest(frame, nb, log):
28 win = TestCheckBox(nb, log)
29 return win
30
31#---------------------------------------------------------------------------
32
33
34overview = """\
35A checkbox is a labelled box which is either on (checkmark is visible) or off
36(no checkmark).
37
38"""
39
40#---------------------------------------------------------------------------
41
42if __name__ == '__main__':
43 import sys,os
44 import run
45 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
46