1999-04-30 03:29:54 +00:00
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
import wx
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2003-12-09 01:23:28 +00:00
|
|
|
class TestRadioBox(wx.Panel):
|
1999-04-30 03:29:54 +00:00
|
|
|
def __init__(self, parent, log):
|
|
|
|
self.log = log
|
2003-12-09 01:23:28 +00:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
|
|
|
#self.SetBackgroundColour(wx.BLUE)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
|
|
|
'six', 'seven', 'eight']
|
|
|
|
|
2003-12-09 01:23:28 +00: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-13 03:17:17 +00:00
|
|
|
#rb.SetLabel("wx.RadioBox")
|
1999-07-31 07:56:15 +00:00
|
|
|
|
2003-12-09 01:23:28 +00: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 23:59:08 +00:00
|
|
|
|
|
|
|
self.SetSizer(sizer)
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
def EvtRadioBox(self, event):
|
|
|
|
self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
2003-12-09 01:23:28 +00:00
|
|
|
win = TestRadioBox(nb, log)
|
1999-04-30 03:29:54 +00:00
|
|
|
return win
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
2004-01-13 03:17:17 +00:00
|
|
|
A RadioBox is used to select one of a number of mutually exclusive
|
2003-03-25 06:35:27 +00:00
|
|
|
choices. It is displayed as a vertical column or horizontal row of
|
2004-01-13 03:17:17 +00:00
|
|
|
labelled buttons, surrounded by a box that can optionally have a
|
|
|
|
label.
|
1999-04-30 03:29:54 +00:00
|
|
|
|
2001-05-18 21:59:59 +00:00
|
|
|
"""
|
1999-04-30 03:29:54 +00:00
|
|
|
|
|
|
|
|
2003-03-25 06:35:27 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
2004-03-05 00:06:33 +00:00
|
|
|
run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
|
2003-03-25 06:35:27 +00:00
|
|
|
|