]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/RadioBox.py
1 # 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
3 # o Updated for wx namespace
8 #---------------------------------------------------------------------------
10 class TestRadioBox(wx
.Panel
):
11 def __init__(self
, parent
, log
):
13 wx
.Panel
.__init
__(self
, parent
, -1)
14 #self.SetBackgroundColour(wx.BLUE)
16 sampleList
= ['zero', 'one', 'two', 'three', 'four', 'five',
17 'six', 'seven', 'eight']
19 sizer
= wx
.BoxSizer(wx
.VERTICAL
)
22 self
, -1, "wx.RadioBox", wx
.DefaultPosition
, wx
.DefaultSize
,
23 sampleList
, 2, wx
.RA_SPECIFY_COLS
26 self
.Bind(wx
.EVT_RADIOBOX
, self
.EvtRadioBox
, rb
)
27 #rb.SetBackgroundColour(wx.BLUE)
28 rb
.SetToolTip(wx
.ToolTip("This is a ToolTip!"))
29 #rb.SetLabel("wxRadioBox")
31 sizer
.Add(rb
, 0, wx
.ALL
, 20)
34 self
, -1, "", wx
.DefaultPosition
, wx
.DefaultSize
,
35 sampleList
, 3, wx
.RA_SPECIFY_COLS | wx
.NO_BORDER
38 self
.Bind(wx
.EVT_RADIOBOX
, self
.EvtRadioBox
, rb
)
39 rb
.SetToolTip(wx
.ToolTip("This box has no label"))
41 sizer
.Add(rb
, 0, wx
.LEFT|wx
.RIGHT|wx
.BOTTOM
, 20)
46 def EvtRadioBox(self
, event
):
47 self
.log
.WriteText('EvtRadioBox: %d\n' % event
.GetInt())
49 # Doesn't appear to be used for anything.
50 # def EvtRadioButton(self, event):
51 # self.log.write('EvtRadioButton:%d\n' % event.GetId())
53 #---------------------------------------------------------------------------
55 def runTest(frame
, nb
, log
):
56 win
= TestRadioBox(nb
, log
)
62 A radio box item is used to select one of number of mutually exclusive
63 choices. It is displayed as a vertical column or horizontal row of
69 if __name__
== '__main__':
72 run
.main(['', os
.path
.basename(sys
.argv
[0])])