communication between objects - help
davea at ieee.org
Fri Apr 10 12:32:54 CEST 2009
Murali kumar wrote:
> hi all..
> I'm posted in a word doc becoz to add a image to explain my problem..
> also I think gmail automatically scans for attachments..
> anyway.. here's my problem...( see the image)
> Using : Python 2.6 , wxPython 2.8.9
> * I don’t know how to return config file or data to mainApp object when
> pressing load button. *
> * Is it easy to return filename only and load the file’s data into mainApp
> object in menu handler itself? *
> Please suggest me right direction.. and tell me how to do it?
> Usually where I can get these informations.. (suggest links and books..)
> Thanks for any advice....
Most of the widget classes in your code should be derived classes, so
they can hold extra instance data & event handlers and such. So that
means you can have extra parameters on the constructor, besides the ones
the base class requires. Use one or more of those extra parameters to
store your own information about the hierarchy.
Simplest example is to add the app instance to each constructor. Then
each widget object would know how to call back into the app to do some
work, or to load data into a common place.
More information about the Python-list