|
class gtk.SizeGroup( |
|
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
.
gtk.SizeGroup(mode
)
| the mode for the new size group. |
Returns : | a new gtk.SizeGroup |
Creates a new gtk.SizeGroup
with the mode specified by the value of mode
which is
one of the GTK SizeGroup Mode Constants.
def 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).
def 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.
def set_ignore_hidden(ignore_hidden
)
| If True hidden widgets should
be ignored when calculating the size |
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.
def get_ignore_hidden()
Returns : | True if hidden widgets are
ignored in size calculations. |
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.
def add_widget(widget
)
| the gtk.Widget to
add |
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.
def remove_widget(widget
)
| the gtk.Widget to
remove |
The remove_widget() method removes the widget specified by
widget from the gtk.SizeGroup
.
© manpagez.com 2000-2024 Individual documents may contain additional copyright information.