]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/CheckBox.py
It *does* work now
[wxWidgets.git] / wxPython / demo / CheckBox.py
1 # 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 #---------------------------------------------------------------------------
9
10 class TestCheckBox(wx.Panel):
11 def __init__(self, parent, log):
12 self.log = log
13 wx.Panel.__init__(self, parent, -1)
14
15 wx.StaticText(self, -1, "This example uses the wxCheckBox control.", (10, 10))
16
17 cID = wx.NewId()
18 cb1 = wx.CheckBox(self, cID, " Apples", (65, 40), (150, 20), wx.NO_BORDER)
19 cb2 = wx.CheckBox(self, cID+1, " Oranges", (65, 60), (150, 20), wx.NO_BORDER)
20 cb2.SetValue(True)
21 cb3 = wx.CheckBox(self, cID+2, " Pears", (65, 80), (150, 20), wx.NO_BORDER)
22
23 self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb1)
24 self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb2)
25 self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb3)
26
27 def EvtCheckBox(self, event):
28 self.log.WriteText('EvtCheckBox: %d\n' % event.IsChecked())
29
30 #---------------------------------------------------------------------------
31
32 def runTest(frame, nb, log):
33 win = TestCheckBox(nb, log)
34 return win
35
36 #---------------------------------------------------------------------------
37
38
39
40
41
42 overview = """\
43 A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
44
45 """
46
47
48
49 if __name__ == '__main__':
50 import sys,os
51 import run
52 run.main(['', os.path.basename(sys.argv[0])])
53