Exiting Tkinter when using IDLE
Batista, Facundo
FBatista at uniFON.com.ar
Mon Mar 15 19:42:56 EST 2004
Kinda lost throug the mails.
At the end, and taking care of all that considerations, what is the
recommended method to quit?
Thank you all!
. Facundo
#- -----Mensaje original-----
#- De: kbk at shore.net [mailto:kbk at shore.net]
#- Enviado el: Domingo 14 de Marzo de 2004 10:03 PM
#- Para: python-list at python.org
#- Asunto: Re: Exiting Tkinter when using IDLE
#-
#-
#- Jason Harper <JasonHarper at pobox.com> writes:
#-
#- > In a non-subprocess IDLE, you don't have to hit a
#- breakpoint to be able
#- > to examine a running Tkinter program. Both the shell
#- window and the
#- > user program are fully responsive at the same time. For
#- example, you
#- > could type a command to change the appearance of a button, and
#- > IMMEDIATELY try out the button with its new appearance, since the
#- > mainloop is still running. This ability is lost in a
#- subprocess IDLE.
#-
#- OK, another good reason to retain the non-subprocess capability. The
#- user Tkinter code is mixed in with IDLE's Tkinkter code, but there is
#- a practical use for experimenting with layouts. To get this to work
#- cleanly, you eliminate the mainloop() call and use destroy():
#-
#- ===================
#- IDLE without subprocess (-n switch):
#-
#- from Tkinter import *
#-
#- class App:
#-
#- def __init__(self, master):
#-
#- frame = Frame(master)
#- frame.pack()
#-
#- self.button = Button(frame, text="QUIT", fg="red",
#- command=self.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!"
#-
#- def quit(self):
#- print "quitting"
#- a = raw_input("prompt: ")
#- print a
#- root.destroy()
#-
#- root = Tk()
#- app = App(root)
#-
#- =======================
#-
#- And, as you say, you can do amusing things like
#-
#- >>> app.button["text"]
#- 'QUIT'
#- >>> app.button["text"] = "REALLY QUIT"
#-
#- --
#- KBK
#- --
#- http://mail.python.org/mailman/listinfo/python-list
#-
More information about the Python-list
mailing list