gtk.SizeGroup
gtk.SizeGroup — an object that groups widgets so they request the same
size
Description
gtk.SizeGroup
provides a mechanism for grouping a number of widgets together so they all
request the same amount of space. This is typically useful when you want a
column of widgets to have the same size, but you can't use a gtk.Table widget. The
size requested for each widget in a gtk.SizeGroup is
the maximum of the sizes that would have been requested for each widget in
the size group if they were not in the size group. The mode of the size
group (see set_mode()
and the GTK SizeGroup Mode Constants) determines whether
this applies to the horizontal size, the vertical size, or both
sizes:
Note that size groups only affect the amount of space requested,
not the size that the widgets finally receive. If you want the widgets in a
gtk.SizeGroup to
actually be the same size, you need to pack them in such a way that they get
the size they request and not more. For example, if you are packing your
widgets into a table, you would not include the gtk.FILL
flag. gtk.SizeGroup
objects are referenced by each widget in the size group, so once you have
added all widgets to a gtk.SizeGroup. If
the widgets in the size group are subsequently destroyed, then they will be
removed from the size group and drop their references on the size group;
when all widgets have been removed, the size group will be freed.
Widgets can be part of multiple size groups; PyGTK will compute
the horizontal size of a widget from the horizontal requisition of all
widgets that can be reached from the widget by a chain of size groups of
type gtk.SIZE_GROUP_HORIZONTAL or
gtk.SIZE_GROUP_BOTH, and the vertical size from the
vertical requisition of all widgets that can be reached from the widget by a
chain of size groups of type gtk.SIZE_GROUP_VERTICAL or
gtk.SIZE_GROUP_BOTH.
Methods
gtk.SizeGroup.set_mode
mode : | the mode to set for the size
group. |
The set_mode() method sets the "mode"
property of the size group to the value specified by
mode. The "mode" of the size group determines whether
the widgets in the size group should all have the same horizontal
requisition (see the GTK SizeGroup Mode Constants).
gtk.SizeGroup.get_mode
Returns : | the current mode of the size
group. |
The get_mode() method returns the value
of the "mode" property of the size group. See the set_mode()
method.
gtk.SizeGroup.set_ignore_hidden
def set_ignore_hidden(ignore_hidden)
|
ignore_hidden : | If TRUE hidden widgets should
be ignored when calculating the size |
Note
This method is available in PyGTK 2.8 and above.
The set_ignore_hidden() method sets the
"ignore-hidden" property to the value of
ignore_hidden. If
ignore_hidden is TRUE invisible
widgets will be ignored when calculating size.
gtk.SizeGroup.get_ignore_hidden
Returns : | TRUE if hidden widgets are
ignored in size calculations. |
Note
This method is available in PyGTK 2.8 and above.
The get_ignore_hidden() method returns
the value of the "ignore-hidden" property of the size group. If
"ignore-hidden" is TRUE, invisible widgets are ignored in
size calculations.
gtk.SizeGroup.add_widget
The add_widget() method adds the widget
specified by widget to the gtk.SizeGroup.
The requisition of the widget will then be determined as the maximum of its
requisition and the requisition of the other widgets in the size group.
Whether this applies horizontally, vertically, or in both directions depends
on the mode of the size group. See the set_mode()
method for more detail.
gtk.SizeGroup.remove_widget
def remove_widget(widget)
|
The remove_widget() method removes the widget specified by
widget from the gtk.SizeGroup.