Accessing wx.TextCtrl after refactoring
rhodri at wildebst.demon.co.uk
Sat Mar 28 01:51:04 CET 2009
On Fri, 27 Mar 2009 21:51:19 -0000, alex <alecla at bluewin.ch> wrote:
> Hi all
> I am working on a Dialog window for a gui in wxPython and started
> refactoring it, below code is a simplified version of it.
> "def createInput1" should create a static text, a button and a
> textcontrol using the information in "def box1Labels".
> "def makeStaticBox1" then arranges all widgets in staticbox1.
> My problem is that it works fine for the static text and the button
> label but I cant "rename" self.txtctrl that it
> becomes self.txtctrl_inpath or self.txtctrl_outpath for getting the
> path from either "def BrowseInDlg" or "def BrowseOutDlg".
You need the special __setattr__ method. A normal object attribute
self.wombat = "go"
is equivalent to a call of
So in your createInput1 method, once the widgets have been created
and all the dust has settled, if you add the line:
it will do exactly what you're after!
Rhodri James *-* Wildebeeste Herder to the Masses
More information about the Python-list