Newbie: saving dialog variables

Jeremy Bowers jerf at jerf.org
Sat May 7 10:34:15 EDT 2005


On Sat, 07 May 2005 13:24:34 +0000, jeff elkins wrote:

> Howdy,
> 
> I've written a program that calls an imported dialog to gather some needed 
> input. What's the common method for passing that data back to the caller? I've 
> tried a 'return data' prior to self.Close() ... all that happens then is the 
> dialog won't close. I'm sure this is obvious, but this newbie's stuck!
> 
> Thanks,
> 
> Jeff

In general, the dialog is an instance of a class. Once the dialog closes,
the window should be gone but the instance variable should still be around. 
Common practice is to put the relevant data in the dialog instance member
for retrieval after closing. In certain cases, the method used to invoke
the dialog will return the relevant value, but this is somewhat limiting.
In even more rare cases, the dialog will be popped up by a function,
giving no direct reference to the dialog at any point, and the value is
returned by the function; this is generally limited to the "Yes/No/Cancel"
style dialog or its simpler bretheren ("OK/Cancel" and "OK").

I'm assuming that last one is not the case.

To be more directly helpful, we'd need more data, ideally a code snippet
fully demonstrating the problem (i.e., a runnable program). But at a bare
minimum, we'd need to know where this dialog came from. Tk? PyGTK?
wxPython? Some curses library? MFC?



More information about the Python-list mailing list