2 from wxPython
.wx
import *
4 #---------------------------------------------------------------------------
14 class TestRadioButtons(wxPanel
):
15 def __init__(self
, parent
, log
):
17 wxPanel
.__init
__(self
, parent
, -1)
18 #self.SetBackgroundColour(wxBLUE)
20 sampleList
= ['zero', 'one', 'two', 'three', 'four', 'five',
21 'six', 'seven', 'eight']
23 sizer
= wxBoxSizer(wxVERTICAL
)
24 rb
= wxRadioBox(self
, RBOX1
, "wxRadioBox",
25 wxDefaultPosition
, wxDefaultSize
,
26 sampleList
, 2, wxRA_SPECIFY_COLS
)
27 EVT_RADIOBOX(self
, RBOX1
, self
.EvtRadioBox
)
28 #rb.SetBackgroundColour(wxBLUE)
29 rb
.SetToolTip(wxToolTip("This is a ToolTip!"))
30 #rb.SetLabel("wxRadioBox")
31 sizer
.Add(rb
, 0, wxALL
, 20)
33 rb
= wxRadioBox(self
, RBOX2
, "", wxDefaultPosition
, wxDefaultSize
,
34 sampleList
, 3, wxRA_SPECIFY_COLS | wxNO_BORDER
)
35 EVT_RADIOBOX(self
, RBOX2
, self
.EvtRadioBox
)
36 rb
.SetToolTip(wxToolTip("This box has no label"))
37 sizer
.Add(rb
, 0, wxLEFT|wxRIGHT|wxBOTTOM
, 20)
42 def EvtRadioBox(self
, event
):
43 self
.log
.WriteText('EvtRadioBox: %d\n' % event
.GetInt())
45 def EvtRadioButton(self
, event
):
46 self
.log
.write('EvtRadioButton:%d\n' % event
.GetId())
48 #---------------------------------------------------------------------------
50 def runTest(frame
, nb
, log
):
51 win
= TestRadioButtons(nb
, log
)
57 A radio box item is used to select one of number of mutually exclusive
58 choices. It is displayed as a vertical column or horizontal row of
65 if __name__
== '__main__':
68 run
.main(['', os
.path
.basename(sys
.argv
[0])])