Re: sending parameter from child window to parent?

Phil Edwards <[email protected]>
Newsgroups gmane.comp.python.pythoncard
Message-ID <[email protected]>
Alec Bennett wrote:
> I'm wondering if anyone might give me a clue about how to send a 
> parameter from a child window to the parent? I have the child window 
> launched, it can set gui components in the parent (for example 
> self.parent.components.whatever.text = "hello"), and the parent can set 
> gui components in the child, but I'm unable to set variables directly.
> 
> I'm building the child/parent relationship the way David does in this 
> tutorial:
> 
> http://pythoncard.sourceforge.net/walkthrough3.html
> 
> I could use some duct tape and have a thread checking the contents of a 
> text field that I set from the other window, but that's just so ugly.
> 
> I've gone through all the samples and all the documentation I could find 
> and can't figure it out.
> 
> Anyone?
> 

The trick is in the fact that your child window is always active, but is 
(usually anyway, YMMV) not actually made visible on screen until needed, 
by calling:

self.myChildWindow.show()

You should be able to just set a class member variable in your child 
window code and have the parent window pick it up later. So in your 
child window, you'd want:

self.someVariable = ['spam', 'chips', 'beans']

Then in your main window, you can access this as 
self.myChildwindow.someVariable. As you've already discovered, it works 
the other way round, too, i.e. you could do this in your parent window:

self.otherVariable = ['spam', 'eggs', 'spam']

Then have the child window reference this as self.parent.otherVariable.

-- 

Regards

Phil Edwards
Brighton, UK

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.