X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8eca4fef106b8327e2e55636de3f68a511a4c392..b4eecebd423df0c6efe86d7658cd3df818d67ed8:/wxPython/demo/RadioButton.py diff --git a/wxPython/demo/RadioButton.py b/wxPython/demo/RadioButton.py index c76dd4a804..f2205207eb 100644 --- a/wxPython/demo/RadioButton.py +++ b/wxPython/demo/RadioButton.py @@ -10,54 +10,54 @@ class TestPanel( wx.Panel ): self.log = log panel = wx.Panel( self, -1 ) + # Layout controls on panel: + vs = wx.BoxSizer( wx.VERTICAL ) + + box1_title = wx.StaticBox( panel, -1, "Group 1" ) + box1 = wx.StaticBoxSizer( box1_title, wx.VERTICAL ) + grid1 = wx.FlexGridSizer( 0, 2, 0, 0 ) + # 1st group of controls: self.group1_ctrls = [] radio1 = wx.RadioButton( panel, -1, " Radio1 ", style = wx.RB_GROUP ) - text1 = wx.TextCtrl( panel, -1, "" ) radio2 = wx.RadioButton( panel, -1, " Radio2 " ) - text2 = wx.TextCtrl( panel, -1, "" ) radio3 = wx.RadioButton( panel, -1, " Radio3 " ) + text1 = wx.TextCtrl( panel, -1, "" ) + text2 = wx.TextCtrl( panel, -1, "" ) text3 = wx.TextCtrl( panel, -1, "" ) self.group1_ctrls.append((radio1, text1)) self.group1_ctrls.append((radio2, text2)) self.group1_ctrls.append((radio3, text3)) + for radio, text in self.group1_ctrls: + grid1.Add( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) + grid1.Add( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) + + box1.Add( grid1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) + vs.Add( box1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) + + box2_title = wx.StaticBox( panel, -1, "Group 2" ) + box2 = wx.StaticBoxSizer( box2_title, wx.VERTICAL ) + grid2 = wx.FlexGridSizer( 0, 2, 0, 0 ) + # 2nd group of controls: self.group2_ctrls = [] radio4 = wx.RadioButton( panel, -1, " Radio1 ", style = wx.RB_GROUP ) - text4 = wx.TextCtrl( panel, -1, "" ) radio5 = wx.RadioButton( panel, -1, " Radio2 " ) - text5 = wx.TextCtrl( panel, -1, "" ) radio6 = wx.RadioButton( panel, -1, " Radio3 " ) + text4 = wx.TextCtrl( panel, -1, "" ) + text5 = wx.TextCtrl( panel, -1, "" ) text6 = wx.TextCtrl( panel, -1, "" ) self.group2_ctrls.append((radio4, text4)) self.group2_ctrls.append((radio5, text5)) self.group2_ctrls.append((radio6, text6)) - - # Layout controls on panel: - vs = wx.BoxSizer( wx.VERTICAL ) - - box1_title = wx.StaticBox( panel, -1, "Group 1" ) - box1 = wx.StaticBoxSizer( box1_title, wx.VERTICAL ) - grid1 = wx.FlexGridSizer( 0, 2, 0, 0 ) - - for radio, text in self.group1_ctrls: - grid1.AddWindow( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) - grid1.AddWindow( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) - - box1.AddSizer( grid1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - vs.AddSizer( box1, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - - box2_title = wx.StaticBox( panel, -1, "Group 2" ) - box2 = wx.StaticBoxSizer( box2_title, wx.VERTICAL ) - grid2 = wx.FlexGridSizer( 0, 2, 0, 0 ) - + for radio, text in self.group2_ctrls: - grid2.AddWindow( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) - grid2.AddWindow( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) + grid2.Add( radio, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) + grid2.Add( text, 0, wx.ALIGN_CENTRE|wx.LEFT|wx.RIGHT|wx.TOP, 5 ) - box2.AddSizer( grid2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) - vs.AddSizer( box2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) + box2.Add( grid2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) + vs.Add( box2, 0, wx.ALIGN_CENTRE|wx.ALL, 5 ) panel.SetSizer( vs ) vs.Fit( panel )