[Tutor] help with Tkinter, please

Alan Gauld alan.gauld at btinternet.com
Mon Nov 27 00:09:56 CET 2006

"Dick Moores" <rdm at rcblue.com> wrote

> Some time has passed and I've made some progress. My question now is
> about the placement of buttons.
> one, but I can't get the layout I want, which is the Label on top of
> the Entry, then a row of the first 3 buttons (which respectively
> trigger 3 different computations on the integer the user enters).
> Then below that, the Exit button, with the Text widget at the 
> bottom.

Sounds like 4 frames to me:
1 Frame for the outer 'skin', packed with fill for both X and Y.

1 frame for the label/entry combo, using pack to position the widgets
inside the frame, then pack the frame inside the outer frame

1 frame for the row of buttons and I'd use grid to position the
buttons insdide the frame and then pack the frame into the
outer frame (I tend to use grid where I'm positioning things
horizontally and pack when i'm doing it vertiacally. So I
divide my GUI into horizontal layers and then use grid
inside teach layer for horizontally laid out widgets)

1 frame for the bottom exit button and pack it into the

> How to do this? Is it impossible with the pack() method?

Horizontal layouts are possible using pack, take a look at
the GUI topic and the GUI section of the Case Study topic
in my tutor for examples of using pure pack. But IMHO grid
is easier for horizontal sets.

Mixing layout styles in a GUI is fine provided you keep each
layout in a frame to itself.


Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list