I'm making a GUI for a console-based program I just wrote. I figured it would be mostly straight forward to convert it over in wxPython but now I'm confused.
In my console program, I have __init__ making the dictionaries et al. and then my methods will populate them. However, when I use wxGlade under SPE to make the GUI, wxGlade makes it's own __init__. I know not to add anything to this section because it's written over everytime I make changes in wxGlade. How do I reconcile having the auto created __init__ from wxGlade and the __init__ I want to use from my console version? Here's an example of my console program: def __init__(self): """Constructor to initialize each data member to zero.""" #---Attribute info self.attrib = 0 self.attrib_dict = self.default_attribs.copy() #instance version self.setAttribute("str") self.setAttribute("intel") self.setAttribute("build") self.setAttribute("char") self.setAttribute("will") self.setAttribute("throw") self.setAttribute("mass") self.setAttribute("load") self.setAttribute("dex") self.coreInitiative = 0 #---Create attributes--- def setAttribute(self, attr): """Generate value for an attribute, between 2 and 20.""" #---Get secondary attributes if attr == "throw": self.attrib_dict[attr] = self.attrib_dict["str"] * 2 #meters elif attr == "mass": self.attrib_dict[attr] = (self.attrib_dict["build"] * 5) + 15 #kg elif attr == "load": self.attrib_dict[attr] = (self.attrib_dict["str"] + self.attrib_dict["build"]) #kg #---Get core attributes else: self.attrib_dict[attr] = multiDie(2, 2) #2d10 Here's the code created by wxGlade: class Attributes(wx.Frame): def __init__(self, *args, **kwds): # begin wxGlade: Attributes.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.panel_2 = wx.Panel(self, -1) self.btnAttributes = wx.Button(self.panel_2, -1, "Get Attributes") self.lblAge = wx.StaticText(self.panel_2, -1, "Age:") self.txtAge = wx.TextCtrl(self.panel_2, -1, "") self.lblChar = wx.StaticText(self.panel_2, -1, "Charisma:") self.txtChar = wx.TextCtrl(self.panel_2, -1, "") self.lblStr = wx.StaticText(self.panel_2, -1, "Strength:") self.txtStr = wx.TextCtrl(self.panel_2, -1, "") self.lblBuild = wx.StaticText(self.panel_2, -1, "Build:") self.txtBuild = wx.TextCtrl(self.panel_2, -1, "") self.lblIntel = wx.StaticText(self.panel_2, -1, "Intelligence:") self.txtIntel = wx.TextCtrl(self.panel_2, -1, "") self.lblThrow = wx.StaticText(self.panel_2, -1, "Throw Range:") self.txtThrow = wx.TextCtrl(self.panel_2, -1, "") self.lblWill = wx.StaticText(self.panel_2, -1, "Willpower:") self.txtWill = wx.TextCtrl(self.panel_2, -1, "") self.lblMass = wx.StaticText(self.panel_2, -1, "Mass:") self.txtMass = wx.TextCtrl(self.panel_2, -1, "") self.lblDex = wx.StaticText(self.panel_2, -1, "Dexterity:") self.txtDex = wx.TextCtrl(self.panel_2, -1, "") self.lblLoad = wx.StaticText(self.panel_2, -1, "Load:") self.txtLoad = wx.TextCtrl(self.panel_2, -1, "") self.lblHP = wx.StaticText(self.panel_2, -1, "Hit Points") self.lblHead = wx.StaticText(self.panel_2, -1, "Head:") self.txtHead = wx.TextCtrl(self.panel_2, -1, "") self.lblTorso = wx.StaticText(self.panel_2, -1, "Torso:") self.txtTorso = wx.TextCtrl(self.panel_2, -1, "") self.lblRArm = wx.StaticText(self.panel_2, -1, "Right Arm:") self.txtRArm = wx.TextCtrl(self.panel_2, -1, "") self.lblLArm = wx.StaticText(self.panel_2, -1, "Left Arm:") self.txtLArm = wx.TextCtrl(self.panel_2, -1, "") self.lblRLeg = wx.StaticText(self.panel_2, -1, "Right Leg:") self.txtRLeg = wx.TextCtrl(self.panel_2, -1, "") self.lblLLeg = wx.StaticText(self.panel_2, -1, "Left Leg:") self.text_ctrl_18 = wx.TextCtrl(self.panel_2, -1, "") self.btnNext2 = wx.Button(self.panel_2, -1, "Next Page") self.__set_properties() self.__do_layout() # end wxGlade -- http://mail.python.org/mailman/listinfo/python-list