[Tutor] Tk code problem (Joseph Q.)

Joseph Quigley cpu.crazy at gmail.com
Mon Apr 11 22:20:42 CEST 2005


Hi,
It seems that whenever I click the QUIT button the TK windows freezes, then 
I have to CTRL-ALT-DEL to be able to shut it down. Here's the code (its not 
mine though):



from Tkinter import *

class App:

     def __init__(self, master):

         frame = Frame(master)
         frame.pack()

         self.button = Button(frame, text="QUIT", fg="red", command=frame.quit)
         self.button.pack(side=LEFT)

         self.hi_there = Button(frame, text="Hello", command=self.say_hi)
         self.hi_there.pack(side=LEFT)

     def say_hi(self):
         print "hi there, everyone!"

root = Tk()

app = App(root)

root.mainloop()


It's probably the
command=frame.quit

Is there another command to close the Tk program? (like raise  SystemExit 
and sys.exit()  for the text based programs)

Also could I do something like root and tk = Tk()?

Thanks,
         Joseph.

P.S  I'm currently looking for an dedicated python IDE (or IDLE, i never 
can tell the difference between the two)
for Linux. I know about emacs and vi (or vim) (but they're not dedicated). 
I was wondering if any of you know of any.  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050411/fea77691/attachment.html


More information about the Tutor mailing list