- Sample Codes
2.9 Precise positioning of buttons
|Written by kksou|
|Wednesday, 26 March 2008|
In the previous example, we have arbitrarily left a gap between the buttons.
Suppose now you want to this gap to be exactly of 10 pixels wide between the buttons.
You might have read somewhere that it's not possible to do precise positioning in php-gtk, because everything is relative. The only way is to use GtkFixed but this is strongly discouraged because there will no longer be automatic layout management provided by php-gtk. This, is not really true.
If you understand the previous few examples, you already know how to do precise positioning and sizing in php-gtk! – yes, it is just a matter of stacking a pile of hboxes and vboxes on top of each other (just like the lego blocks), with the right setting of the expand parameter during packing.
We make use of the code in the previous example.
Now try to resize the window. You will see that the gap will always remain precisely at 10 pixel because we have set expand=false.
|< Prev||Next >|