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

Rick Johnson rantingrickjohnson at gmail.com
Fri Mar 2 03:55:18 CET 2012


On Mar 1, 12:14 am, John Salerno <johnj... at gmail.com> wrote:
> > What exactly is the purpose of doing that? Does Tk do some extra work that a simple call to Frame won't do?
>
> More specifically, what is the benefit of doing:
>
> root = tk.Tk()
> app = Application(master=root)
> app.mainloop()
>
> as opposed to:
>
> app = Application()
> app.mainloop()
>
> Also, in the first example, what is the difference between calling app.mainloop() and root.mainloop()? They both seemed to work when I ran them.

I tell you what. Just keep coding Tkinter GUIs like these broken docs
tell you to, than after you become proficient you will understand. You
will say: "That Rick really knew what he was talking about after all!"



More information about the Python-list mailing list