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