]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/CheckBox.py
Corrected _setCallbackInfo code so GiveFeedback can work
[wxWidgets.git] / wxPython / demo / CheckBox.py
1
2 import wx
3
4 #---------------------------------------------------------------------------
5
6 class 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
27 def runTest(frame, nb, log):
28 win = TestCheckBox(nb, log)
29 return win
30
31 #---------------------------------------------------------------------------
32
33
34 overview = """\
35 A checkbox is a labelled box which is either on (checkmark is visible) or off
36 (no checkmark).
37
38 """
39
40 #---------------------------------------------------------------------------
41
42 if __name__ == '__main__':
43 import sys,os
44 import run
45 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
46