gtk.Alignmenta widget that controls the alignment and size of its
childSynopsisgtk.Alignmentgtk.Bingtk.Alignmentxalign0.0yalign0.0xscale0.0yscale0.0setxalignyalignxscaleyscaleset_paddingpadding_toppadding_bottompadding_leftpadding_rightget_paddingAncestry+-- gobject.GObject
+-- gtk.Object
+-- gtk.Widget
+-- gtk.Container
+-- gtk.Bin
+-- gtk.Alignment
Implemented Interfacesgtk.Alignment
implements
gtk.Buildablegtk.Alignment Propertiesgtk.Object Propertiesgtk.Widget Propertiesgtk.Container Properties
"bottom-padding"Read/WriteThe padding to insert at the bottom of the widget. GTK+ 2.4
and above."left-padding"Read/WriteThe padding to insert at the left of the widget. GTK+ 2.4
and above."right-padding"Read/WriteThe padding to insert at the right of the widget. GTK+ 2.4
and above."top-padding"Read/WriteThe padding to insert at the top of the widget. GTK+ 2.4
and above."xalign"Read/WriteThe fraction of horizontal free space
to the left of the child. 0.0 means no free
space to the left, 1.0 means all free space
to the left."xscale"Read/WriteThe fraction of horizontal free space
(beyond that needed by the child) that the child will absorb. 0.0 means the
child will absorb none, 1.0 means the child will absorb all"yalign"Read/WriteThe fraction of vertical free space
above the child. 0.0 means no free space
above, 1.0 means all free space
above."yscale"Read/WriteThe fraction of vertical free space
(beyond that needed by the child) that the child will absorb. 0.0 means the
child will absorb none, 1.0 means the child will absorb all
gtk.Alignment Style Propertiesgtk.Widget Style Propertiesgtk.Alignment Signal Prototypesgobject.GObject Signal Prototypesgtk.Object Signal Prototypesgtk.Widget Signal Prototypesgtk.Container Signal PrototypesDescriptionThe gtk.Alignment
widget controls the alignment and size of its child widget. It has four
properties: xscale, yscale, xalign, and yalign. The scale properties are
used to specify how much of the free (extra) space
allocated to the gtk.Alignment
should be absorbed by the child widget. The values can range from 0.0
(meaning the child absorbs none) to 1.0 (meaning the child absorbs all of
the free space). If the value is 0.5, the child widget
absorbs half the free space. The align properties are
used to place the child widget within the available area by specifying the
fraction of free space that will be placed above or to
the left of the child widget. The values range from 0.0 (no
free space above or to the left of the child) to 1.0
(all free space above or to the left of the child). Of
course, if the scale properties are both set to 1.0, the alignment
properties have no effect.An example may make this clearer. A gtk.Button widget (32
pixels wide by 32 pixels high) is placed inside a gtk.Alignment
widget (256 pixels wide by 128 pixels high) which has xalign of 0.25, yalign
of 0.25, xscale of 0.25 and yscale of 0.25. The horizontal
free space is 256-32=224 pixels and the vertical
free space is 128-32=96 pixels. The button will absorb
0.25x224=56 pixels horizontally and 0.25x96=24 pixels vertically since the
xscale and yscale are 0.25 thus becoming 32+56=88 pixels wide by 32+24=56
pixels high. This will leave 256-88=168 pixels of horizontal
free space and 128-56=72 pixels of vertical
free space. Since the xalign value is 0.25 the
horizontal free space will be allocated as 0.25x168=42
pixels to the left of the button and 0.72x168=126 pixels to the right.
Likewise since the yalign is 0.25 the vertical free
space is allocated as 0.25x72=18 pixels above the button and 0.75*72=54
pixels below.Constructorgtk.Alignmentxalign0.0yalign0.0xscale0.0yscale0.0xalign :the fraction of horizontal
free space to the left of the child widget. Ranges from
0.0 to 1.0yalign :the fraction of vertical
free space above the child widget. Ranges from 0.0 to
1.0xscale :the fraction of horizontal
free space that the child widget absorbs, from 0.0 to
1.0yscale :the fraction of vertical
free space that the child widget absorbs, from 0.0 to
1.0Returns :a new alignment objectCreates a new alignment widget with the specified properties. If
the scale and alignment parameters are not specified they default to
0.0.Methodsgtk.Alignment.setsetxalignyalignxscaleyscalexalign :the fraction of horizontal
free space to the left of the child widget. Ranges from
0.0 to 1.0yalign :the fraction of vertical
free space above the child widget. Ranges from 0.0 to
1.0xscale :the fraction of horizontal
free space that the child widget absorbs, from 0.0 to
1.0yscale :the fraction of vertical
free space that the child widget absorbs, from 0.0 to
1.0The set() method sets the properties of
the alignment widget to the specified values.gtk.Alignment.set_paddingset_paddingpadding_toppadding_bottompadding_leftpadding_rightpadding_top : the padding at the top of the
widgetpadding_bottom : the padding at the bottom of the
widgetpadding_left : the padding at the left of the
widgetpadding_right : the padding at the right of the
widget.This method is available in PyGTK 2.4 and above.The set_padding() method sets the
padding around the sides of the alignment widget to the values specified by
padding_top, padding_bottom,
padding_left and
padding_right. The padding adds blank space to the
sides of the widget. For instance, this can be used to indent the child
widget toward the right by adding padding on the left.gtk.Alignment.get_paddingget_paddingReturns :a 4-tuple containing the padding set on the
top, bottom, left and right sides of the
widgetThis method is available in PyGTK 2.4 and above.The get_padding() method returns a
4-tuple containing the padding set on the sides of the widget.