1999-04-29 23:29:54 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class TestRadioBox(wx.Panel):
|
1999-04-29 23:29:54 -04:00
|
|
|
def __init__(self, parent, log):
|
|
|
|
self.log = log
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
|
|
|
#self.SetBackgroundColour(wx.BLUE)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
|
|
|
'six', 'seven', 'eight']
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
|
|
|
rb = wx.RadioBox(
|
|
|
|
self, -1, "wx.RadioBox", wx.DefaultPosition, wx.DefaultSize,
|
|
|
|
sampleList, 2, wx.RA_SPECIFY_COLS
|
|
|
|
)
|
|
|
|
|
|
|
|
self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb)
|
|
|
|
#rb.SetBackgroundColour(wx.BLUE)
|
|
|
|
rb.SetToolTip(wx.ToolTip("This is a ToolTip!"))
|
2004-01-12 22:17:17 -05:00
|
|
|
#rb.SetLabel("wx.RadioBox")
|
1999-07-31 03:56:15 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
sizer.Add(rb, 0, wx.ALL, 20)
|
|
|
|
|
|
|
|
rb = wx.RadioBox(
|
|
|
|
self, -1, "", wx.DefaultPosition, wx.DefaultSize,
|
|
|
|
sampleList, 3, wx.RA_SPECIFY_COLS | wx.NO_BORDER
|
|
|
|
)
|
|
|
|
|
|
|
|
self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb)
|
|
|
|
rb.SetToolTip(wx.ToolTip("This box has no label"))
|
|
|
|
|
|
|
|
sizer.Add(rb, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 20)
|
2002-08-13 19:59:08 -04:00
|
|
|
|
|
|
|
self.SetSizer(sizer)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
def EvtRadioBox(self, event):
|
|
|
|
self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
2003-12-08 20:23:28 -05:00
|
|
|
win = TestRadioBox(nb, log)
|
1999-04-29 23:29:54 -04:00
|
|
|
return win
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
2004-01-12 22:17:17 -05:00
|
|
|
A RadioBox is used to select one of a number of mutually exclusive
|
2003-03-25 01:35:27 -05:00
|
|
|
choices. It is displayed as a vertical column or horizontal row of
|
2004-01-12 22:17:17 -05:00
|
|
|
labelled buttons, surrounded by a box that can optionally have a
|
|
|
|
label.
|
1999-04-29 23:29:54 -04:00
|
|
|
|
2001-05-18 17:59:59 -04:00
|
|
|
"""
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-04 19:06:33 -05:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2003-03-25 01:35:27 -05:00
|
|
|
|