PyGTK For GUI Programming/Packing

Packing is used to place the widgets in the application.

There are three types of packing.

Horizontal Box (HBox) - Horizontal row structure
Vertical Box (VBox) - Vertical row structure
Table/Grid (Table) - Table like structure

To place the widget inside the packing :

1. Create the packing object

hbox = gtk.HBox()

2. Add the widget to the box call the pack_start or pack_end method of the packing object

box.pack_start(widget, expand, fill, padding)

pack_start will start placing the widget from the start (left to right, top to bottom)
pack_end will start placing the widget from the end (right to left, bottom to top)

3. Show the box and widget

widget.show()
box.show()

The format of the packing widgets is :

hbox = gtk.HBox(homogeneous, spacing)
vbox = gtk.VBox(homogeneous, spacing)
table = gtk.Table(rows, columns, homogeneous)

← Input Widgets Packing
Last modified on 20 February 2013, at 16:15