Imagine the window to which widgets will be added as a big rectangle. Every time a widget is added by calling a pack-function, the remaining rectangle will be divided in two: one part will contain the added widget, the other part will be used to add other widgets. When a widget is packed on the right side of the rectangle, room will be left on the left side for future packs. An example will make this more clear.
An empty window:
Add a widget (for example a button b1) to the bottom side by calling the pack() member function:
b1 = new button(".b1", "-text Button1"); b1 -> pack("-side bottom -fill x");
The window will now have the following form
:
Next, we can add a button b2 to the right side of the remaining rectangle with
b2 = new button(".b2", "-text Button2 -height 10"); b2 -> pack("-side right -fill y");
The window now shows:
When a button b3 is added at the bottom side of the remaining rectangle with
b3 = new button(".b3", "-text Button3"); b3 -> pack("-side bottom -fill x");
the result will be: