Go forward in time to May 2010.
This is the story of two little olives.
Hello, my friend, what have you been doing?
Let me tell you about my deadly battle with a fierce toothpick.
Don't you say! How impressive, what valour!
The toothpick was about this thick.
Tell me no more, I can't bear to hear it!
Now more than ever, we olives have to stand together.
No more toothpicks, only red peppers will pierce our hearts!
Script - Oralia
Puppets - Luciana
Photos - Federico
This is how a GtkBox lays out its children. Yellow is the spacing that you specify in gtk_hbox_new() or gtk_vbox_new(). Beige is padding, which I'll convince you to set to zero. Orange is the actual child widgets inside the box.
In the first example, you see a box with a spacing of 2 (trust me, that yellow is 2 units). The children are thus uniformly spaced, and everything is nice and easy to understand.
In the second example, you see a box with the same spacing of 2 units between children, but each child has a different padding. The leftmost child has a padding of 1 unit, which you see on both sides of that child. The second child has a padding of 2 units, the third child has a padding of 3 units, and the rightmost child has no padding. This is a big mess.
Spacing is the uniform space that GtkBox puts between child widgets.
Padding can be different for each child, and it gets applied on both sides of each child. So each child gets an allocation of at least (padding + requisition + padding).
Other containers like GtkTable also have their own padding parameters for children (GtkTable lets you set different paddings in the X and Y directions).
Summary: if you are using a padding different from zero, you are making a mistake in 99% of cases. Use a good spacing, and a padding of zero. Otherwise you make it really hard to align other widgets in the container hierarchy when someone else has to modify your code. If you really need padding, it's generally better to use a GtkAlignment around your widget and pad that instead of messing up the parent container.
This has been a public service announcement.
Go backward in time to March 2010.Federico Mena-Quintero <email@example.com> Thu 2010/Apr/22 15:28:59 CDT