Tkinter grid layout

Richard Lewis richardlewis at fastmail.co.uk
Wed Jul 6 12:55:01 EDT 2005


On Wed, 06 Jul 2005 16:32:42 GMT, "William Gill" <noreply at gcgroup.net>
said:
> Excuse me for intruding, but I followed examples and ended up with a 
> similar architecture:
> 
>      from Tkinter import *
>      class MyMain(Frame):
>          def __init__(self, master):
>              self.root = master
>              self.master=master
>      root = Tk()
>      app = MyMain(root)
>      app.master.title("Object Editor")
>      root.mainloop()
> 
> Erick, are you saying it should be modified to something like :
> 
>      from Tkinter import *
>      class MyMain(Tk):
>      ...
>      ...
>      app = MyMain()
>      app.title("My App")
>      app.mainloop()
> 
This is what I've got now, and it works. I don't think I've seen many
examples which inherited from Tk, but it certainly solved my problem.
And I see the logic in it: Tk is the main window of an application,
while Frame is, as Eric said, just a generic container.

Cheers,
Richard



More information about the Python-list mailing list