2 from wxPython
.wx
import *
4 #---------------------------------------------------------------------------
6 class TestRadioButtons(wxPanel
):
7 def __init__(self
, parent
, log
):
9 wxPanel
.__init
__(self
, parent
, -1)
10 #self.SetBackgroundColour(wxBLUE)
12 sampleList
= ['zero', 'one', 'two', 'three', 'four', 'five',
13 'six', 'seven', 'eight']
15 rb
= wxRadioBox(self
, 30, "wxRadioBox", wxPoint(35, 30), wxDefaultSize
,
16 sampleList
, 3, wxRA_SPECIFY_COLS
)
17 EVT_RADIOBOX(self
, 30, self
.EvtRadioBox
)
18 #rb.SetBackgroundColour(wxBLUE)
19 rb
.SetToolTip(wxToolTip("This is a ToolTip!"))
21 wxRadioButton(self
, 32, "wxRadioButton", (235, 35))
22 wxRadioButton(self
, 33, "wxRadioButton", (235, 55))
23 EVT_RADIOBUTTON(self
, 32, self
.EvtRadioButton
)
24 EVT_RADIOBUTTON(self
, 33, self
.EvtRadioButton
)
26 rb
= wxRadioBox(self
, 35, "", wxPoint(35, 120), wxDefaultSize
,
27 sampleList
, 3, wxRA_SPECIFY_COLS | wxNO_BORDER
)
28 EVT_RADIOBOX(self
, 35, self
.EvtRadioBox
)
31 def EvtRadioBox(self
, event
):
32 self
.log
.WriteText('EvtRadioBox: %d\n' % event
.GetInt())
34 def EvtRadioButton(self
, event
):
35 self
.log
.write('EvtRadioButton:%d\n' % event
.GetInt())
37 #---------------------------------------------------------------------------
39 def runTest(frame
, nb
, log
):
40 win
= TestRadioButtons(nb
, log
)
43 #---------------------------------------------------------------------------
56 A radio box item is used to select one of number of mutually exclusive choices. It is displayed as a vertical column or horizontal row of labelled buttons.