[Tutor] is it legal to have a class within a def
alan.gauld at btinternet.com
Thu Jan 3 09:22:25 CET 2008
"johnf" <jfabiani at yolo.com> wrote
> 1 and 3 are my reasons. I'm creating a Dabo app. When I attempted
> to create
> a special class that contained a dialog box I discovered that the
> class created an indepentant type of window and allowed my program
> continue running without waiting for the dialog to return a value
Are you sure you made it a modal dialog?
Any dialog will do that if it is opened modelessly, you need to
use the modal version to make it block the app.
Putting the class code in a functiion is legal but very inefficient
and also prevents you from storing state etc in the dialog - you
would need to reinitialise all valuues on each use. Thats OK if
its simple but a lot of work(and slow) if its complex.
Author of the Learn to Program web site
More information about the Tutor