Tkinter Confusion

MartinRinehart at gmail.com MartinRinehart at gmail.com
Sun Feb 17 14:36:25 EST 2008


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.



More information about the Python-list mailing list