Tkinter Confusion

Sam Garson peanut.sam at googlemail.com
Sun Feb 17 17:12:36 EST 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 gmail.com> 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.
> --
> http://mail.python.org/mailman/listinfo/python-list
>



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

SaM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080217/90b13a9e/attachment-0001.html>


More information about the Python-list mailing list