def __init__(self): ''' The constructor. Creates a wx.PySizer. Must be called from the __init__ in the derived class. ''' theClass = 'PySizer' wx.RegisterFirstCallerClassName(self, theClass) Sizer.__init__(self) try: self.theFirstCallerName != theClass except AttributeError: self.theFirstCallerName = theClass self.tsBeginClassRegistration(theClass, wx.ID_ANY) ## self.ts_Children = wxSizerItemList() ## self.ts_ContainingWindow = None ## self.ts_MinSize = None ## self.ts_Position = None ## self.ts_Size = None self.tsEndClassRegistration(theClass)
def __init__(self, orient=wx.HORIZONTAL): ''' Constructor for a wx.BoxSizer. orient may be one of wx.VERTICAL or wx.HORIZONTAL for creating either a column sizer or a row sizer. ''' theClass = 'BoxSizer' wx.RegisterFirstCallerClassName(self, theClass) Sizer.__init__(self) self.tsBeginClassRegistration(theClass, id) # either wxHORIZONTAL or wxVERTICAL self.ts_Orientation = orient # the sum of proportion of all of our elements self.ts_TotalProportion = 0 # minimal size needed for this sizer as calculated by # the last call to our CalcMin() self.ts_MinSize = DEFAULT_SIZE # minimal size needed for this sizer as calculated, by # calcMin, for the containing window (panel), the parent # of those subpanels managed by this BoxSizer instance. self.ts_CalcMinArea = [] self.ts_CalcMinAreaProportion = [] self.ts_CalcMinKind = [] self.ts_CalcMinWindow = [] self.ts_ClientArea = [] self.ts_ContainingWindow = None self.ts_MinSize = wxSize(0, 0) self.ts_SizeMinThis = [] self.ts_TotalFixedSize = wxSize(0, 0) self.ts_TotalProportion = 0 ## self.ts_SizeMinThis = None ## self.ts_CalcMinArea = None ## self.ts_CalcMinAreaProportion = None ## self.ts_CalcMinKind = None ## self.ts_CalcMinWindow = None ## self.ts_ClientArea = None ## self.ts_ContainingWindow = None self.ts_RecalcArea = None self.tsEndClassRegistration(theClass)
def __init__(self, vgap=0, hgap=0): ''' Constructor, with optional parameters to specify the gap between the rows and columns. ''' theClass = 'GridBagSizer' wx.RegisterFirstCallerClassName(self, theClass) Sizer.__init__(self) self.tsBeginClassRegistration(theClass, id) self.ts_vgap = vgap self.ts_hgap = hgap self.tsEndClassRegistration(theClass)
def __init__(self, *args, **kwargs): ''' Constructor for a wx.GridSizer. rows and cols determine the number of columns and rows in the sizer - if either of the parameters is zero, it will be calculated to from the total number of children in the sizer, thus making the sizer grow dynamically. vgap and hgap define extra space between all children. ''' theClass = 'GridSizer' wx.RegisterFirstCallerClassName(self, theClass) Sizer.__init__(self) try: self.theFirstCallerName != theClass except AttributeError: self.theFirstCallerName = theClass self.tsBeginClassRegistration(theClass, wx.ID_ANY) if ((len(args) == 0) and \ (len(kwargs) == 0)): # Instatiate Grid Class without using args or kwargs # associated with instantiation variants. rows = 0 cols = 0 vgap = 0 hgap = 0 elif ((len(args) + len(kwargs)) == 2): # Instatiate Grid Class without using args or kwargs # associated with instantiation variants. if ((isinstance(args[0], int)) and \ (isinstance(args[1], wxSize))): # def __init__(self, cols, gap): cols = args[0] vgap = args[1].height hgap = args[1].width else: # def __init__(self, Cols=0, Gap=wx.DefaultSize): cols = kwargs['Col'] vgap = kwargs['Gap'].height hgap = kwargs['Gap'].width if cols == 0: rows = 1 else: rows = 0 self.logger.wxASSERT(cols >= 0) elif ((len(args) + len(kwargs)) == 3): # Instatiate Grid Class without using args or kwargs # associated with instantiation variants. if ((isinstance(args[0], int)) and \ (isinstance(args[1], int)) and \ (isinstance(args[2], int))): # def __init__(self, cols, vgap, hgap): cols = args[0] vgap = args[1] hgap = args[2] if cols == 0: rows = 1 else: rows = 0 elif ((isinstance(args[0], int)) and \ (isinstance(args[1], int)) and \ (isinstance(args[2], wxSize))): # def __init__(self, rows, cols, gap): rows = args[0] cols = args[1] vgap = args[2].height hgap = args[2].width else: # def __init__(self, rows=0, cols=0, gap=wx.DefaultSize): rows = kwargs['Rows'] cols = kwargs['Cols'] vgap = kwargs['Gap'].height hgap = kwargs['Gap'].width self.logger.wxASSERT(cols >= 0) else: # if ((len(args) + len(kwargs)) == 4): if (len(args) == 4): # Instatiate Grid Class without using args or kwargs # associated with instantiation variants. # def __init__(self, rows, cols, vgap, hgap): rows = args[0] cols = args[1] vgap = args[2] hgap = args[3] else: # Instatiate Grid Class without using args or kwargs # associated with instantiation variants. # def __init__(self, rows=1, cols=0, vgap=0, hgap=0): rows = kwargs['Rows'] cols = kwargs['Cols'] vgap = kwargs['Vgap'] hgap = kwargs['Hgap'] if ((rows == 0) and \ (cols == 0)): rows = 1 self.logger.wxASSERT((rows >= 0) and (cols >= 0)) if ((rows | cols) == 0): self.ts_Rows = 1 else: self.ts_Rows = rows self.ts_Cols = cols self.ts_HGap = hgap self.ts_VGap = vgap ## self.ts_ContainingWindowClientArea = DEFAULT_SIZE self.tsEndClassRegistration(theClass)