Tkinter grid layout

Richard Lewis richardlewis at
Wed Jul 6 18:21:35 CEST 2005

On Wed, 06 Jul 2005 17:36:01 +0200, "Eric Brunel"
<eric_brunel at> said:
> On Wed, 06 Jul 2005 11:44:55 +0100, Richard Lewis
> <richardlewis at> wrote:
> > Hi there,
> >
> > I've got a tree control in Tkinter (using the ESRF Tree module) but I
> > can't get it to layout how I want it.
> >
> > I'd like to have it so that it streches north/south (anchored to the top
> > and bottom), is of a fixed width and is anchored to the left hand side.
> > Here's my code (its derived from one of the examples from the ESRF web
> > site):
> >
> > class MainWindow(Frame):
> [snip code]
> First of all, it is not a good idea to make your so-called window inherit
> from Frame: a Frame is not a window in tk, but a generic container.
> [....]
> But basically, my advice would be:
> - Never make your windows inherit from Frame; make them inherit from Tk
> for the main window or from Toplevel for all other ones
> - When you have resize problems, always check the whole widget hierarchy
> from the actual window down to the widget showing the problem. The cause
> is very often not on the widget itself, but on one of its containers.
And very sound advice it turns out to be! I've changed my MainWindow
class to inherit from Tk and now all the layout works fine.

Thanks very much for your help!


More information about the Python-list mailing list