wxPython/wxGlade-0.9.1/widgets/radio_box/radio_box.py
def _do_layout(self):
        "Lays out the radio buttons according to the values of self.style and self.major_dim"
        if not self.widget:
            return
        buttons_layout = self.buttons
        if self.dimension:
            if self.style & wx.RA_SPECIFY_COLS:
                cols = self.dimension
                rows = 0
            else:
                cols = 0
                rows = self.dimension
            sizer = wx.GridSizer(rows, cols, 0, 0)
            if wx.Platform == '__WXGTK__':
                # we need to reorder self.buttons 'cos wxRadioBox lays out its
                # elements by colums, while wxGridSizer by rows
                import math
                if not rows:
                    step = int(math.ceil(1.0*len(self.buttons)/cols))
                else:
                    step = rows
                tmp = [[] for i in range(step)]
                for i, button in enumerate(self.buttons):
                    tmp[i%step].append(button)
                buttons_layout = []
                for t in tmp:
                    buttons_layout.extend(t)
        else:
            sizer = wx.BoxSizer(wx.VERTICAL)
        for button in buttons_layout:
            w, h = button.GetBestSize()
            sizer.Add(button, 0, wx.EXPAND)
            sizer.SetItemMinSize(button, w, h)
        self.widget.SetAutoLayout(True)
        sb_sizer = wx.StaticBoxSizer(self.static_box, wx.VERTICAL)
        self.widget.SetSizer(sb_sizer)
        sb_sizer.Add(sizer, 1, wx.EXPAND)
        sb_sizer.SetMinSize(sizer.GetMinSize())
        sb_sizer.Fit(self.widget)
        self.sizer.set_item_best_size(self, size=self.widget.GetBestSize())
Lays out the radio buttons according to the values of self.style and self.major_dim
Lays out the radio buttons according to the values of self.style and self.major_dim
Lays out the radio buttons according to the values of self . style and self . major_dim
def _do_layout(self):
        if not self.widget:
            return
        buttons_layout = self.buttons
        if self.dimension:
            if self.style & wx.RA_SPECIFY_COLS:
                cols = self.dimension
                rows = 0
            else:
                cols = 0
                rows = self.dimension
            sizer = wx.GridSizer(rows, cols, 0, 0)
            if wx.Platform == '__WXGTK__':
                import math
                if not rows:
                    step = int(math.ceil(1.0*len(self.buttons)/cols))
                else:
                    step = rows
                tmp = [[] for i in range(step)]
                for i, button in enumerate(self.buttons):
                    tmp[i%step].append(button)
                buttons_layout = []
                for t in tmp:
                    buttons_layout.extend(t)
        else:
            sizer = wx.BoxSizer(wx.VERTICAL)
        for button in buttons_layout:
            w, h = button.GetBestSize()
            sizer.Add(button, 0, wx.EXPAND)
            sizer.SetItemMinSize(button, w, h)
        self.widget.SetAutoLayout(True)
        sb_sizer = wx.StaticBoxSizer(self.static_box, wx.VERTICAL)
        self.widget.SetSizer(sb_sizer)
        sb_sizer.Add(sizer, 1, wx.EXPAND)
        sb_sizer.SetMinSize(sizer.GetMinSize())
        sb_sizer.Fit(self.widget)
        self.sizer.set_item_best_size(self, size=self.widget.GetBestSize())
def _do_layout ( self ) : if not self . widget : return buttons_layout = self . buttons if self . dimension : if self . style & wx . RA_SPECIFY_COLS : cols = self . dimension rows = 0 else : cols = 0 rows = self . dimension sizer = wx . GridSizer ( rows , cols , 0 , 0 ) if wx . Platform == '__WXGTK__' : import math if not rows : step = int ( math . ceil ( 1.0 * len ( self . buttons ) / cols ) ) else : step = rows tmp = [ [ ] for i in range ( step ) ] for i , button in enumerate ( self . buttons ) : tmp [ i % step ] . append ( button ) buttons_layout = [ ] for t in tmp : buttons_layout . extend ( t ) else : sizer = wx . BoxSizer ( wx . VERTICAL ) for button in buttons_layout : w , h = button . GetBestSize ( ) sizer . Add ( button , 0 , wx . EXPAND ) sizer . SetItemMinSize ( button , w , h ) self . widget . SetAutoLayout ( True ) sb_sizer = wx . StaticBoxSizer ( self . static_box , wx . VERTICAL ) self . widget . SetSizer ( sb_sizer ) sb_sizer . Add ( sizer , 1 , wx . EXPAND ) sb_sizer . SetMinSize ( sizer . GetMinSize ( ) ) sb_sizer . Fit ( self . widget ) self . sizer . set_item_best_size ( self , size = self . widget . GetBestSize ( ) )
Lays out the radio buttons according to the values of self.style and self.major_dim
Lays out the radio buttons according to the values of self . style and self . major_dim
"Lays out the radio buttons according to the values of self.style and self.major_dim" # we need to reorder self.buttons 'cos wxRadioBox lays out its # elements by colums, while wxGridSizer by rows
self