[Tutor] Is this a "Class" problem?

Kent Johnson kent37 at tds.net
Fri Aug 29 23:31:29 CEST 2008


On Fri, Aug 29, 2008 at 12:19 PM, Adrian Greyling
<adrian.greyling at gmail.com> wrote:

> Here's where I get fuzzy...  Let's say I've got a "frame_1" object
> that opens a new "frame_2" object.  As you've suggested above, I'll use "m"
> to create an instance of a frame object.  Now frame_2 opens a "dialog_1'"
> which asks for information that is sent back to 'frame_2'. How do I
> reference 'frame_2' in this case?  Especially when frame_2 hasn't been
> closed and has just been waiting behind dialog_1 until dialog_1 closes.
> When I try to reference it again as "m = frame_2(self)" from a new function
> definition, aren't I creating a brand new frame_2 object that has "blank"
> attributes, so to speak?

Generally the way this works is something like:
- frame 2 creates dialog box
- frame 2 shows dialog box and waits for the dialog box to be dismissed
- frame 2 gets result from dialog box

There are several examples of this in the wx demo, see
MultiChoiceDialog, SingleChoiceDialog, TextEntryDialog. If you are
writing your own custom dialog, make a method that allows the client
code to retrieve the user data from it.

Kent


More information about the Tutor mailing list