def __init__( self, parent, id=wx.ID_ANY, label=wx.EmptyString, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, validator=wx.DefaultValidator, name=wx.FrameButtonNameStr, useClientArea=True, ): """ Create and show a button. The preferred way to create standard buttons is to use a standard ID and an empty label. In this case wxWigets will automatically use a stock label that corresponds to the ID given. These labels may vary across platforms as the platform itself will provide the label if possible. In addition, the button will be decorated with stock icons under GTK+ 2. """ theClass = "FrameButton" wx.RegisterFirstCallerClassName(self, theClass) Button.__init__( self, parent=parent, id=id, label=label, pos=pos, size=size, style=style, validator=validator, name=name, useClientArea=useClientArea, ) # Capture initial caller parametsrs before they are changed self.caller_parent = parent self.caller_id = id self.caller_label = label self.caller_pos = pos self.caller_size = size self.caller_style = style self.caller_validator = validator self.caller_name = name self.tsBeginClassRegistration(theClass, id) if DEBUG: self.logger.debug(" self: %s" % self) self.logger.debug(" parent: %s" % parent) self.logger.debug(" id: %s" % self.ts_Id) self.logger.debug(" AssignedId: %s" % self.ts_AssignedId) self.logger.debug(" label: %s" % label) self.logger.debug(" pos: %s" % str(pos)) self.logger.debug(" size: %s" % str(size)) self.logger.debug(" style: 0x%X" % style) self.logger.debug(" name: %s" % name) self.ts_Default = False self.ts_Name = name self.ts_Parent = parent theTopLevelClass = self self.SetTopLevelAncestor(theTopLevelClass) if parent is None: self.ts_GrandParent = None else: self.ts_GrandParent = parent.Parent if False: # Leaves artifacts of different color than parent background. self.ts_BackgroundColour = wx.ThemeToUse["BackgroundColour"].lower() self.ts_ForegroundColour = wx.ThemeToUse["ForegroundColour"].lower() else: # Inter-button spaces have same color as parent background. self.ts_BackgroundColour = self.Parent.ts_BackgroundColour self.ts_ForegroundColour = self.Parent.ts_ForegroundColour self.ts_Style = style self.ts_Label = label self.ts_ButtonText = self.tsStripAcceleratorTextLabel(label) self.ts_UseClientArea = useClientArea self.ts_Validator = validator (myRect, myClientRect) = self.tsButtonLayout(parent, pos, size, style, name) self.ts_Rect = myRect self.ts_ClientRect = myClientRect # Automatically Bind all mouse events ASAP (now). # Will register event in the SystemEventTable. event = EVT_COMMAND_LEFT_CLICK handler = self.tsOnLeftClick source = self self.Bind(event, handler, source, useSystemEventTable=True) self.tsEndClassRegistration(theClass)