]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxRadioBox.py
reSWIGged
[wxWidgets.git] / wxPython / demo / wxRadioBox.py
CommitLineData
8fa876ca
RD
1# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2#
3# o Updated for wx namespace
4#
cf694132 5
8fa876ca 6import wx
cf694132
RD
7
8#---------------------------------------------------------------------------
9
8fa876ca 10class TestRadioBox(wx.Panel):
cf694132
RD
11 def __init__(self, parent, log):
12 self.log = log
8fa876ca
RD
13 wx.Panel.__init__(self, parent, -1)
14 #self.SetBackgroundColour(wx.BLUE)
cf694132
RD
15
16 sampleList = ['zero', 'one', 'two', 'three', 'four', 'five',
17 'six', 'seven', 'eight']
18
8fa876ca
RD
19 sizer = wx.BoxSizer(wx.VERTICAL)
20
21 rb = wx.RadioBox(
22 self, -1, "wx.RadioBox", wx.DefaultPosition, wx.DefaultSize,
23 sampleList, 2, wx.RA_SPECIFY_COLS
24 )
25
26 self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb)
27 #rb.SetBackgroundColour(wx.BLUE)
28 rb.SetToolTip(wx.ToolTip("This is a ToolTip!"))
eb0f373c 29 #rb.SetLabel("wxRadioBox")
8bf5d46e 30
8fa876ca
RD
31 sizer.Add(rb, 0, wx.ALL, 20)
32
33 rb = wx.RadioBox(
34 self, -1, "", wx.DefaultPosition, wx.DefaultSize,
35 sampleList, 3, wx.RA_SPECIFY_COLS | wx.NO_BORDER
36 )
37
38 self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb)
39 rb.SetToolTip(wx.ToolTip("This box has no label"))
40
41 sizer.Add(rb, 0, wx.LEFT|wx.RIGHT|wx.BOTTOM, 20)
eb0f373c 42
eb0f373c 43 self.SetSizer(sizer)
cf694132
RD
44
45
46 def EvtRadioBox(self, event):
47 self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
48
8fa876ca
RD
49# Doesn't appear to be used for anything.
50# def EvtRadioButton(self, event):
51# self.log.write('EvtRadioButton:%d\n' % event.GetId())
4268f798 52
cf694132
RD
53#---------------------------------------------------------------------------
54
55def runTest(frame, nb, log):
8fa876ca 56 win = TestRadioBox(nb, log)
cf694132
RD
57 return win
58
cf694132
RD
59
60
61overview = """\
1e4a197e
RD
62A radio box item is used to select one of number of mutually exclusive
63choices. It is displayed as a vertical column or horizontal row of
64labelled buttons.
cf694132 65
493f1553 66"""
cf694132 67
cf694132 68
1e4a197e
RD
69if __name__ == '__main__':
70 import sys,os
71 import run
72 run.main(['', os.path.basename(sys.argv[0])])
73