Newbie Tkinter: how to quit window? (Win98, IDLE, Python 2.0b)
Kirby Urner
urner at alumni.princeton.edu
Thu Sep 21 11:59:02 EDT 2000
Kirby Urner <urner at alumni.princeton.edu> wrote:
>This doesn't seem to be the behavior documented in
>Tkinter class, which says quit method will cause all
>widgets to be destroyed.
I should add that pressing the Quit button a second
time (after getting the IDLE prompt back on the first),
closes IDLE/Python altogether.
I'm thinking this behavior (of command=root.quit not
closing the window) has to do with starting Tk.mainloop()
from within IDLE (itself a Tk application). Given IDLE
is where I'd like younger school students to operate,
having a 'Quit' button that closes the window (doesn't
stick around inviting a 2nd click) is the behavior I
need.
Kirby
>=============================
>
># simple graphing -- tkgraph.py
>
># doesn't actually graph anything yet -- just testing
># window behavior
>
>from Tkinter import *
>
>def drawgraph():
> root = Tk()
> canvas = Canvas(root,height=400,width=400, bg='white')
> canvas.pack()
> Button(root,text='Quit',command=root.quit).pack()
> root.mainloop()
>
>
More information about the Python-list
mailing list