]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/RadioBox.py
   4 #--------------------------------------------------------------------------- 
   6 class TestRadioBox(wx
.Panel
): 
   7     def __init__(self
, parent
, log
): 
   9         wx
.Panel
.__init
__(self
, parent
, -1) 
  10         #self.SetBackgroundColour(wx.BLUE) 
  12         sampleList 
= ['zero', 'one', 'two', 'three', 'four', 'five', 
  13                       'six', 'seven', 'eight'] 
  15         sizer 
= wx
.BoxSizer(wx
.VERTICAL
) 
  18                 self
, -1, "wx.RadioBox", wx
.DefaultPosition
, wx
.DefaultSize
, 
  19                 sampleList
, 2, wx
.RA_SPECIFY_COLS
 
  22         self
.Bind(wx
.EVT_RADIOBOX
, self
.EvtRadioBox
, rb
) 
  23         #rb.SetBackgroundColour(wx.BLUE) 
  24         rb
.SetToolTip(wx
.ToolTip("This is a ToolTip!")) 
  25         #rb.SetLabel("wx.RadioBox") 
  27         sizer
.Add(rb
, 0, wx
.ALL
, 20) 
  30                 self
, -1, "", wx
.DefaultPosition
, wx
.DefaultSize
, 
  31                 sampleList
, 3, wx
.RA_SPECIFY_COLS | wx
.NO_BORDER
 
  34         self
.Bind(wx
.EVT_RADIOBOX
, self
.EvtRadioBox
, rb
) 
  35         rb
.SetToolTip(wx
.ToolTip("This box has no label")) 
  37         sizer
.Add(rb
, 0, wx
.LEFT|wx
.RIGHT|wx
.BOTTOM
, 20) 
  42     def EvtRadioBox(self
, event
): 
  43         self
.log
.WriteText('EvtRadioBox: %d\n' % event
.GetInt()) 
  45 #--------------------------------------------------------------------------- 
  47 def runTest(frame
, nb
, log
): 
  48     win 
= TestRadioBox(nb
, log
) 
  54 A RadioBox is used to select one of a number of mutually exclusive 
  55 choices.  It is displayed as a vertical column or horizontal row of 
  56 labelled buttons, surrounded by a box that can optionally have a  
  62 if __name__ 
== '__main__': 
  65     run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])