Details of Boxes

Because of this flexibility, packing boxes in GTK can be confusing at first. There are a lot of options, and it's not immediately obvious how they all fit together. In the end, however, there are basically five different styles.

Figure 1. Packing boxes

Each line contains one horizontal box (hbox) with several buttons. The call to pack_start shown, is the one used to pack each of the buttons into the hbox. Each of the buttons is packed into the hbox the same way.

This is the call to box.pack_start.

hbox.pack_start widget, expand, fill, padding

This is the call to

hbox = homogeneous, spacing)

Figure 2. Packing boxes

If fill is set to false, there is little visual difference between the spacing and padding. However, if fill is set to true, there is a difference. with padding, the extra space is part of the widget, and the widget fills this space. With spacing, the extra space is not part of the widget, but lies between the widgets. Thus, the widgets cannot fill this space.