The packer is much more powerful than the placer. The children of a widget are automatically arranged around the edges of the parent's cavity. The user can control where, and how the children are packed, but the layout itself is done by the packer. This is done in several steps:
=1cm
pictures/tclTk/packerSide.ips
Pick a side of the parent widget (master).
The widget (slave) that is packed into the master
is packed to this side of the master.
=1cm
pictures/tclTk/packerSlice.ips
Slice off a frame for slave.
This means, that the packer reserves a area in
the master for the slave. This frame occupies the
complete side of the master.
=1cm
pictures/tclTk/packerChld.ips
Possibly grow slave to fill frame.
If the packing options specify it, the slave widget
is resized to fill the frame in one or both axis.
=1cm
pictures/tclTk/packerSlave.ips
Position slave in frame.
The slave is packed into the master. The position
inside the reserved frame can be specified.
When all this is done, the widget occurs in the parent. Here is a small example of a layout, created with the packer. First the code to pack the widgets:
pack append . .s1 {left filly}
pack append . .l1 {right fill expand}
pack append . .b1 {bottom fillx}
The resulting layout (as shown in figure ) has a button packed to the bottom of the parent
filling the complete width of the parent. The scrollbar is
packed to the left side and occupies the height of the
parent, and the listbox uses the rest of the available
space.