Tkinter Confusion

Sam Garson peanut.sam at
Sun Feb 17 23:12:36 CET 2008

I'm just a beginner, but I think I understand some of this:
The mainloop is not there to build the window, it is there to check for
events, i.e. continually refresh all the widgets. Without, any events you
bind will not be detected.
Tk() is the first window you make, any after that are toplevel()s.
Frame is a widget that I'm sure has benefits in some situations, but I
havent found any difference between that and just inheriting from root.

Hope this helps.

On Feb 17, 2008 7:36 PM, <MartinRinehart at> wrote:

> Everything I've read about Tkinter says you create your window and
> then call its mainloop() method. But that's not really true. This is
> enough to launch a default window from the console:
> >>>from Tkinter import *
> >>>foo = Tk()
> Google's great, but it has no truth meter. Do I inherit from Frame? Or
> is that a big mistake. (Both positions repeated frequently.) Do I use
> Tk() or toplevel()? (Support for both and if a cogent explanation of
> the differences exists, I didn't find it.)
> Here's the application. I'm creating a visual parser for my beginner's
> language. The starting position is a list of Statement objects, each
> being a list of Token objects. The statement is presented as a list of
> buttons with abbreviated token types ('Con_Int' for a CONSTANT_INTEGER
> token). Click the button and a dialog-like info display pops up with
> all the details about the token. During parsing, each recognition
> condenses tokens into productions, shortening the Statement. (Example:
> three Token buttons are replaced by one Addition production button.)
> An application window provides for stepping through the parsing and
> provides utility commands such as "Close all those token windows I've
> got lying all over".
> Much less complex than IDLE, but GvR and cohorts seem to understand
> what's really going on. I don't. Help appreciated.
> --

I intend to live forever - so far, so good.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list