1 | #!/usr/bin/python |
---|
2 | |
---|
3 | import wx |
---|
4 | |
---|
5 | class Example(wx.Frame): |
---|
6 | |
---|
7 | def __init__(self, *args, **kw): |
---|
8 | super(Example, self).__init__(*args, **kw) |
---|
9 | |
---|
10 | self.InitUI() |
---|
11 | |
---|
12 | def InitUI(self): |
---|
13 | |
---|
14 | pnl = wx.Panel(self) |
---|
15 | |
---|
16 | # this is one group |
---|
17 | self.rb1 = wx.RadioButton(pnl, label='Value A', pos=(10, 10), style=wx.RB_GROUP) |
---|
18 | self.rb2 = wx.RadioButton(pnl, label='Value B', pos=(10, 40)) |
---|
19 | self.rb3 = wx.RadioButton(pnl, label='Value C', pos=(10, 70)) |
---|
20 | |
---|
21 | # this should be another group |
---|
22 | self.rb4 = wx.RadioButton(pnl, label='Value 1', pos=(10, 100), style=wx.RB_GROUP) |
---|
23 | self.rb5 = wx.RadioButton(pnl, label='Value 2', pos=(10, 130)) |
---|
24 | |
---|
25 | self.SetSize((210, 250)) |
---|
26 | self.SetTitle('wx.RadioButton') |
---|
27 | self.Centre() |
---|
28 | self.Show(True) |
---|
29 | |
---|
30 | |
---|
31 | def main(): |
---|
32 | |
---|
33 | ex = wx.App() |
---|
34 | Example(None) |
---|
35 | ex.MainLoop() |
---|
36 | |
---|
37 | if __name__ == '__main__': |
---|
38 | main() |
---|