Tk.quit() now working!

A

al pacino

i have a weired problem with button widget in Tkinter
the callback function(Tk.quit()) for button widget is not working! when
i 'press' the button
the GUI hangs.
code for displaying a 'button objec':
###################
import Tkinter
top=Tkinter.Tk()
button=Tkinter.Button(top,text='press me',command=top.quit)#callback to
end the appllication
button.pack()
Tkinter.mainloop()
###################
any comments?
 
F

Fredrik Lundh

al pacino said:
i have a weired problem with button widget in Tkinter
the callback function(Tk.quit()) for button widget is not working! when
i 'press' the button
the GUI hangs.
code for displaying a 'button objec':
###################
import Tkinter
top=Tkinter.Tk()
button=Tkinter.Button(top,text='press me',command=top.quit)#callback to
end the appllication
button.pack()
Tkinter.mainloop()
###################
any comments?

how do you run your Tkinter program ?

</F>
 
A

al pacino

how do you run your Tkinter program ?

like? i was testing it in windows (interactive interpreter)
 
M

Mikael Olofsson

al said:
like? i was testing it in windows (interactive interpreter)

What Fredrik probably means is: Did you by any chance start it from
IDLE? In that case it will not work. It doesn't for me. The reason -
I've been told - is that IDLE itself is a tkinter application.

If you instead start it by simply double-clicking on its icon, as you
would start anything else in Windows, it should work as expected. It
does for me, on Win XP Pro.

HTH
/MiO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
474,283
Messages
2,571,405
Members
48,098
Latest member
inno vation

Latest Threads

Top