[Tutor] Re: Tkinter

Alan Gauld alan.gauld at blueyonder.co.uk
Tue Mar 9 18:59:43 EST 2004

> > I'm confused about pack() and grid().  I understand that you
> > shouldn't pack and grid into the same container.  But can I
> > not grid into a container that is packed into its container?

MIchael explained that bit for you.
(One advantage of getting the digest is most of the hard work is
already done :-)

> Generally, for the kind of window layout I think you intended, I'd
> the use of grid() instead of pack(), because grid makes it very easy
to arrange
> widgets in any number of rows and columns, with pack() you will find
that it is often
> necessary to create extra Frames to arrange your widgets like you

Again I agree with Michael here.

> The strength of pack() is that it is easier to use if you just want
> have one or two widgets inside a Frame and want to control which
> expands and collapses when the window is resized.

Its also most useful with non symetrical layouts. If your GUI fits
a grid pattern grid is great but if the widgts are, for whatver
reason, sprayed all over the window then Pack is mucgh easier.

Plus as Michael says its easier to control just what resizes and
how with pack than with grid.

But in most well designed UIs grid is proably the most appropriate

> ....I prefer grid(), because it can handle anything pack() can,
> but not vice versa.

I'm not sure thats true, but I'll need to go play to see if I can come
up with a valid example... :-)
> I hope this helps
> Michael

More information about the Tutor mailing list