how do I quit exec Tkinter scripts???
Miki Tebeka
tebeka at cs.bgu.ac.il
Wed Aug 28 04:18:08 EDT 2002
Hello revyakin at yahoo.com,
> Sorry, this may sound extremely dumb, but I just started playing
> around with Tkinter (python 2.2) on win 98, and I seem to be unable to
> quit tkinter scripts. E.g. the following hello world script is copied
> and pasted from pythonware.com... I run it from python shell and when
> I close the window that pops up the program keeps running and nothing
> brings the prompt again. Same thing happens when running from C: The
> site says it should quit by closing the GUI window... but it never
> does. Huh???
>
> # File: bind1.py
>
> from Tkinter import *
>
> root = Tk()
>
> def callback(event):
> print "clicked at", event.x, event.y
>
> frame = Frame(root, width=100, height=100)
> frame.bind("<Button-1>", callback)
> frame.pack()
>
> root.mainloop()
root is still active and running mainloop
Try adding a quit button:
Button(master=root, text='Quit', command=root.quit).pack()
HTH.
Miki
More information about the Python-list
mailing list