gtk.AspectFrame — A frame that constrains its child to a particular aspect ratio.
class gtk.AspectFrame(gtk.Frame): |
+--gobject.GObject +-- gtk.Object +-- gtk.Widget +-- gtk.Container +-- gtk.Bin +-- gtk.Frame +-- gtk.AspectFrame
|
The gtk.AspectFrame
packs a widget so that it can resize but always retains the same aspect
ratio. For instance, one might be drawing a small preview of a larger image.
gtk.AspectFrame
derives from gtk.Frame
, so it can
draw a label and a frame around the child. The frame will be
"shrink-wrapped" to the size of the child.
The aspect frame "ratio" property determines the widget width:height ratio. An aspect ratio of 0.5 means the width is one half the height; an aspect ratio of 2.0 means the width is twice the height. The default value for the "ratio" property is 1.0.
The align properties are used to place the child widget within the available area by specifying the fraction of free space (space in the aspect frame that is not used by the child widget) that is placed above or to the left of the child widget. The values range from 0.0 (meaning no free space above or to the left of the child) to 1.0 (meaning all free space above or to the left of the child) . The default value for both align properties is 0.5.
If the "obey-child" property is True (the default value), the "ratio" property is ignored and the aspect ratio is set by the child widget.
gtk.AspectFrame(label
=None, xalign
=0.5, yalign
=0.5, ratio
=1.0, obey_child
=True)
| a string used to set the aspect frame label |
| The 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. |
| The fraction of vertical free space above the child. 0.0 means no free space above, 1.0 means all free space above. |
| the ratio of the child width to height (in the
range 0.0001 to 10000.0) if obey_child is
False |
| if True, ratio is ignored,
and the aspect ratio is taken from the requisition of the
child. |
Returns : | a new aspect frame object |
Creates a new aspect frame object with the specified
label
, xalign
and
yalign
values. The default values are:
label
, None; xalign
, 0.5; and,
yalign
, 0.5. If obey_child
is
True the ratio
value is ignored. If
obey_child
is False, ratio
sets the aspect ratio for the child widget. The default value for
ratio
is 1.0. The default value for
obey_child
is True.
def set(xalign
=0.0, yalign
=0.0, ratio
=1.0, obey_child
=True)
| The 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. |
| The fraction of vertical free space above the child. 0.0 means no free space above, 1.0 means all free space above. |
| the ratio of the child width to height (in the
range 0.0001 to 10000.0) if obey_child is
False |
| if True, ratio is
ignored, and the aspect ratio is taken from the requisition of the
child |
The set
() method changes the aspect
frame properties to the values specified by xalign
,
yalign
, ratio
and
obey_child
. The default values are:
xalign
, 0; yalign
, 0.0;
ratio
, 1.0; and, obey_child
,
True.