1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
from wxPython.wx import *
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
2002-08-13 19:59:08 -04:00
|
|
|
RBUT1 = wxNewId()
|
|
|
|
RBUT2 = wxNewId()
|
2003-03-25 01:35:27 -05:00
|
|
|
RBUT3 = wxNewId()
|
|
|
|
RBUT4 = wxNewId()
|
|
|
|
|
|
|
|
RBOX1 = wxNewId()
|
|
|
|
RBOX2 = wxNewId()
|
2002-08-13 19:59:08 -04:00
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
class TestRadioButtons(wxPanel):
|
|
|
|
def __init__(self, parent, log):
|
|
|
|
self.log = log
|
|
|
|
wxPanel.__init__(self, parent, -1)
|
2000-01-31 16:07:04 -05:00
|
|
|
#self.SetBackgroundColour(wxBLUE)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
|
|
|
|
'six', 'seven', 'eight']
|
|
|
|
|
2002-08-13 19:59:08 -04:00
|
|
|
sizer = wxBoxSizer(wxVERTICAL)
|
|
|
|
rb = wxRadioBox(self, RBOX1, "wxRadioBox",
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
sampleList, 2, wxRA_SPECIFY_COLS)
|
|
|
|
EVT_RADIOBOX(self, RBOX1, self.EvtRadioBox)
|
2000-01-31 16:07:04 -05:00
|
|
|
#rb.SetBackgroundColour(wxBLUE)
|
|
|
|
rb.SetToolTip(wxToolTip("This is a ToolTip!"))
|
2002-08-13 19:59:08 -04:00
|
|
|
#rb.SetLabel("wxRadioBox")
|
|
|
|
sizer.Add(rb, 0, wxALL, 20)
|
1999-07-31 03:56:15 -04:00
|
|
|
|
2002-08-13 19:59:08 -04:00
|
|
|
rb = wxRadioBox(self, RBOX2, "", wxDefaultPosition, wxDefaultSize,
|
1999-04-29 23:29:54 -04:00
|
|
|
sampleList, 3, wxRA_SPECIFY_COLS | wxNO_BORDER)
|
2002-08-13 19:59:08 -04:00
|
|
|
EVT_RADIOBOX(self, RBOX2, self.EvtRadioBox)
|
|
|
|
rb.SetToolTip(wxToolTip("This box has no label"))
|
|
|
|
sizer.Add(rb, 0, wxLEFT|wxRIGHT|wxBOTTOM, 20)
|
|
|
|
|
|
|
|
self.SetSizer(sizer)
|
1999-04-29 23:29:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
def EvtRadioBox(self, event):
|
|
|
|
self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
|
|
|
|
|
2001-12-19 16:25:11 -05:00
|
|
|
def EvtRadioButton(self, event):
|
2003-03-25 01:35:27 -05:00
|
|
|
self.log.write('EvtRadioButton:%d\n' % event.GetId())
|
2001-12-19 16:25:11 -05:00
|
|
|
|
1999-04-29 23:29:54 -04:00
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = TestRadioButtons(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
2003-03-25 01:35:27 -05:00
|
|
|
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.
|
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
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|