Tkinter: Why aren't my widgets expanding when I resize the window?

John Salerno johnjsal at
Mon Mar 5 18:31:09 CET 2012

> You will need to configure the root columns and rows also because the
> configurations DO NOT propagate up the widget hierarchy! Actually, for
> this example, I would recommend using the "pack" geometry manager on
> the frame. Only use grid when you need to use grid. Never use any
> functionality superfluously! Also, you should explicitly pack the
> frame from OUTSIDE frame.__init__()!

Ok, so use pack when putting the frame into the root, since that's all that goes into the root directly. But just out of curiosity, what did I do wrong with using grid? How would it work with grid?

> from tkinter.constants import BOTH, YES

> I always use either:
>  sticky='nswe'
>  sticky=N+S+W+E

This is something I'm not too thrilled with. I don't like importing things piecemeal. I suppose I could do:

import tkinter.constants as tkc (or something like that)

and qualify each constant. Seems like more work, but it just seems better than having to manage each constant that I need in the import list.

Also, N+S+E+W and (N, S, E, W) don't seem to work unless qualified, so that's four more constants I'd have to explicitly import. And (tk.N, tk.S, tk.E, tk.W) is just horrible to look at.

More information about the Python-list mailing list