Returning from Tk

Randall Hopper aa8vb at yahoo.com
Thu Mar 23 19:27:06 EST 2000


Michael Ackerman:
 |
 |I'm trying to learn Tkinter, ... But I cannot find any way to return from
 |a Tkinter program, ... Pressing a Quit button in such programs puts me in
 |some limbo between Python and Tk

Not sure I fully understand your question.  Do you mean to 
return from Tkinter's mainloop() call?

If so, then find a widget, any widget will do (even root), and do a:

   <wgt>.quit()

e.g.:

   >>> from Tkinter import *
   >>> root = Tk()            
   >>> btn = Button( root, text="Hit me to quit", command=root.quit )
   >>> btn.pack()
   >>> root.mainloop()
   >>>                     <---------- we're here after you click the button

-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list