]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/wxToggleButton.py
fix text scrolling in GTK2 (patch 703988)
[wxWidgets.git] / wxPython / demo / wxToggleButton.py
index 80f1cf1c0473c652a581c9111e311970d4218cc4..9e90ae9887c667529148a07d85871665b31fefeb 100644 (file)
@@ -1,6 +1,12 @@
 
 from wxPython.wx import *
 
+haveToggleBtn = 1
+try:
+    wxToggleButton
+except NameError:
+    haveToggleBtn = 0
+
 #----------------------------------------------------------------------
 
 class TestPanel(wxPanel):
@@ -9,12 +15,12 @@ class TestPanel(wxPanel):
         self.log = log
         panel = wxPanel(self, -1)
         buttons = wxBoxSizer(wxHORIZONTAL)
-        for word in string.split("These are toggle buttons"):
+        for word in "These are toggle buttons".split():
             b = wxToggleButton(panel, -1, word)
             EVT_TOGGLEBUTTON(self, b.GetId(), self.OnToggle)
             buttons.Add(b, flag=wxALL, border=5)
 
-        panel.SetAutoLayout(true)
+        panel.SetAutoLayout(True)
         panel.SetSizer(buttons)
         buttons.Fit(panel)
         panel.Move((50,50))
@@ -25,8 +31,16 @@ class TestPanel(wxPanel):
 #----------------------------------------------------------------------
 
 def runTest(frame, nb, log):
-    win = TestPanel(nb, log)
-    return win
+    if haveToggleBtn:
+        win = TestPanel(nb, log)
+        return win
+    else:
+        dlg = wxMessageDialog(frame, 'wxToggleButton is not available on this platform.',
+                          'Sorry', wxOK | wxICON_INFORMATION)
+        dlg.ShowModal()
+        dlg.Destroy()
+
+
 
 
 #----------------------------------------------------------------------
@@ -34,3 +48,12 @@ def runTest(frame, nb, log):
 
 overview = """\
 """
+
+
+
+
+
+if __name__ == '__main__':
+    import sys,os
+    import run
+    run.main(['', os.path.basename(sys.argv[0])])