communication between objects - help

Dave Angel davea at dejaviewphoto.com
Sat Apr 11 08:57:34 EDT 2009



Murali kumar wrote:
> thanks a lot..
>
> I think passing the main object only by reference.. so, this does not causes
> any overhead..
>
> am i correct..?
>
>
> On Fri, Apr 10, 2009 at 4:02 PM, Dave Angel <davea at ieee.org> wrote:
>
>   
>> 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
>>
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>>     
> All objects are passed by reference in python.  And storing it in each widget costs very little.  Note that you can choose what object or objects should be used;  I just mention the app as a choice that everyone will subclass, and that will generally have direct or indirect access to all widgets.
>   




More information about the Python-list mailing list