true/false or TRUE/FALSE to prepare for the new boolean type and constants being added to Python. Added code to wx.py to test for the existence of the new constants and to create suitable values if not present. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
|
|
from wxPython.wx import *
|
|
|
|
haveToggleBtn = 1
|
|
try:
|
|
wxToggleButton
|
|
except NameError:
|
|
haveToggleBtn = 0
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
class TestPanel(wxPanel):
|
|
def __init__(self, parent, log):
|
|
wxPanel.__init__(self, parent, -1)
|
|
self.log = log
|
|
panel = wxPanel(self, -1)
|
|
buttons = wxBoxSizer(wxHORIZONTAL)
|
|
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.SetSizer(buttons)
|
|
buttons.Fit(panel)
|
|
panel.Move((50,50))
|
|
|
|
def OnToggle(self, evt):
|
|
self.log.write("Button %d toggled\n" % evt.GetId())
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
def runTest(frame, nb, log):
|
|
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()
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
|
|
overview = """\
|
|
"""
|