Formatted string to object

janama austuff at gmail.com
Mon Jun 26 10:55:06 EDT 2006


Thankyou everyone for help last time:

The following works ok when setting a
wx.lib.buttons.GenBitmapTextButton's disabled bitmap in using wxpython

instead of this:
self.b1.SetBitmapDisabled(self.yellow)

i can use this:
aaa = 1
result1 = eval("self.b%s.SetBitmapDisabled(self.yellow)" % aaa)
result

YAY!


How would i to achieve this with getattr() ?

getattr(locals()['parent'], aaa)    ???

Why would this be better as recommended in previous post here

http://groups.google.com.au/group/comp.lang.python/browse_frm/thread/2529515bc85cd954/c2f080b21d668081?q=janama&rnum=1#c2f080b21d668081

Any help appreciated

ta




More information about the Python-list mailing list