wxWidgets/wxPython/demo/CheckBox.py
Robin Dunn 8eca4fef10 When running samples from the demo standalone you can now add a
--shell to the command line and it will start a PyShell to go with it.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2004-03-05 00:06:33 +00:00

47 lines
1.4 KiB
Python

import wx
#---------------------------------------------------------------------------
class TestCheckBox(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
wx.StaticText(self, -1, "This example uses the wxCheckBox control.", (10, 10))
cb1 = wx.CheckBox(self, -1, " Apples", (65, 40), (150, 20), wx.NO_BORDER)
cb2 = wx.CheckBox(self, -1, " Oranges", (65, 60), (150, 20), wx.NO_BORDER)
cb2.SetValue(True)
cb3 = wx.CheckBox(self, -1, " Pears", (65, 80), (150, 20), wx.NO_BORDER)
self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb1)
self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb2)
self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb3)
def EvtCheckBox(self, event):
self.log.WriteText('EvtCheckBox: %d\n' % event.IsChecked())
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
win = TestCheckBox(nb, log)
return win
#---------------------------------------------------------------------------
overview = """\
A checkbox is a labelled box which is either on (checkmark is visible) or off
(no checkmark).
"""
#---------------------------------------------------------------------------
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])