communication between objects - help

Dave Angel davea at ieee.org
Fri Apr 10 06:32:54 EDT 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)
>
> http://www.2shared.com/file/5299759/45e4c614/load.html
>
> Using : Python 2.6 , wxPython 2.8.9
> <....snip...>
>
>  * 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.

DaveA



More information about the Python-list mailing list