Tk Dialog Boxes

Newt newt_e at blueyonder.co.uk
Mon Dec 2 16:09:27 EST 2002


Hi,

I'm trying to build a class to represent a dialog box.

I've got an __init__ method that sets most of the class up, and a do_widgets
method that defines all the widgets. The last few lines of the __init__
metod are

        self.wstats.grab_set()
        self.wstats.focus_set()
        self.wstats.wait_window()

which ensures that the screen is responded to before the program continues
any further.

I've got a couple of buttons on the dialog box which have the following code
attatched to them:

    def bquit(self):
        self.wstats.destroy()
        return

The problem I have is that I want to return a value back to the calling
program.

I thought about creating a new method which could do all the display and the
last few lines of the __init__method, but couldn't see how that would help.
Does the destroy() (as seen above) actually destroy the object, or could I
set a propery on it to indicate how the form was exited?

TIA, Newt





More information about the Python-list mailing list