Is it necessary to call Tk() when writing a GUI app with Tkinter?

John Salerno johnjsal at
Thu Mar 1 07:41:53 CET 2012

> Yes. You must leave it out.

Now I'm reading a Tkinter reference at
and it has this example:

from Tkinter import *       

class Application(Frame):              
    def __init__(self, master=None):
        Frame.__init__(self, master)   

    def createWidgets(self):
        self.quitButton = Button ( self, text='Quit',
            command=self.quit )        

app = Application()                    
app.master.title("Sample application") 

Is this just outdated? I don't understand why it uses quit() instead of destroy(). When I try this in IDLE, quit() just causes the application to hang (I assume because it ends the mainloop without actually closing the application). Or is this just a problem when using IDLE?

If the latter, which is preferable, quit or destroy?

More information about the Python-list mailing list