]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxCheckBox.py
Reworked how stock objects are initialized. They now have an
[wxWidgets.git] / wxPython / demo / wxCheckBox.py
index e2e81e3f2840ee5ee045df2e56b46e87bb039039..41fb6779877d4057d6be2775c737f6f0b3f46ea0 100644 (file)
@@ -1,29 +1,31 @@
+# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o Updated for wx namespace
+# 
 
-from wxPython.wx import *
+import  wx
 
 #---------------------------------------------------------------------------
 
-class TestCheckBox(wxPanel):
+class TestCheckBox(wx.Panel):
     def __init__(self, parent, log):
         self.log = log
-        wxPanel.__init__(self, parent, -1)
+        wx.Panel.__init__(self, parent, -1)
 
-        wxStaticText(self, -1, "This example uses the wxCheckBox control.",
-                               wxPoint(10, 10))
+        wx.StaticText(self, -1, "This example uses the wxCheckBox control.", (10, 10))
 
-        cID = NewId()
-        cb1 = wxCheckBox(self, cID,   "  Apples", wxPoint(65, 40), wxSize(150, 20), wxNO_BORDER)
-        cb2 = wxCheckBox(self, cID+1, "  Oranges", wxPoint(65, 60), wxSize(150, 20), wxNO_BORDER)
+        cID = wx.NewId()
+        cb1 = wx.CheckBox(self, cID,   "  Apples", (65, 40), (150, 20), wx.NO_BORDER)
+        cb2 = wx.CheckBox(self, cID+1, "  Oranges", (65, 60), (150, 20), wx.NO_BORDER)
         cb2.SetValue(True)
-        cb3 = wxCheckBox(self, cID+2, "  Pears", wxPoint(65, 80), wxSize(150, 20), wxNO_BORDER)
-
-        EVT_CHECKBOX(self, cID,   self.EvtCheckBox)
-        EVT_CHECKBOX(self, cID+1, self.EvtCheckBox)
-        EVT_CHECKBOX(self, cID+2, self.EvtCheckBox)
+        cb3 = wx.CheckBox(self, cID+2, "  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.Checked())
+        self.log.WriteText('EvtCheckBox: %d\n' % event.IsChecked())
 
 #---------------------------------------------------------------------------
 
@@ -37,17 +39,15 @@ def runTest(frame, nb, log):
 
 
 
+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])])
 
-
-
-
-
-
-overview = """\
-A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
-
-"""