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.
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
widget is a Gtk::Widget. It is the widget to pack into the box.
expand is a boolean. If true, the box expands to fill all available space, and the widgets are spread along the length of the box. If false the box is shrunk to just fit the widgets.
fill is a boolean. It controls whether the extra space is allocated to the widgets themselves (true), or as extra padding in the around the widgets (false). Naturally, it only has an effect if expand argument is also true.
padding is an integer. It creates additional padding around the widget.
This is the call to Gtk::HBox.new.
hbox = Gtk::HBox.new( homogeneous, spacing)
homogeneous is a boolean. It controls whether each object in the box has the same size (i.e. the same width in an hbox, or the same height in a vbox). If true, the expand option has no effect. The pack method behaves as if expand is true regardless.
spacing is an integer. It adds space in between objects. What's the difference between spacing (set when the box is created) and padding (set when elements are packed)? Spacing is added between objects, and padding is added on either side of an object.
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.