tkinter question

Eric Brunel eric_brunel at despammed.com
Fri Mar 31 02:56:48 EST 2006


On 30 Mar 2006 15:11:19 -0800, <linuxnooby at yahoo.com.au> wrote:
>> If you just create
>> a Toplevel and populate it with widgets, it will just display once the
>> control is returned to the Tkinter mainloop and no user input will be
>> needed.
>
> Thanks for explaining that. I borrowed the "after" method that you used
> in your first reply. It seems to do what I want (except for
> root.destroy) Though any suggestions on a more elegant solution
> welcome.
>
> cheers David
[snip start of code]
> def goodbye():
>     print "step 4 you are logged out"
>     root.destroy

This is not a method call. To do what you want, write:
root.destroy()
Methods are first class objects in Python, so root.destroy is just the  
method object for the destroy method applied to root. Written like that,  
it just gets the object, but does not call it.

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list