gtk.AspectFrame

gtk.AspectFrame — A frame that constrains its child to a particular aspect ratio.

Synopsis

class gtk.AspectFrame(gtk.Frame):
    gtk.AspectFrame(label=None, xalign=0.5, yalign=0.5, ratio=1.0, obey_child=TRUE)
def set(xalign=0.0, yalign=0.0, ratio=1.0, obey_child=TRUE)

Ancestry

+-- gobject.GObject
  +-- gtk.Object
    +-- gtk.Widget
      +-- gtk.Container
        +-- gtk.Bin
          +-- gtk.Frame
            +-- gtk.AspectFrame

gtk.AspectFrame Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

gtk.Frame Properties

"obey-child"Read/WriteMake aspect ratio match that of the child widget
"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.
"ratio"Read/WriteThe aspect ratio of the widget in the range of 0.0001 to 10000.0 if "obey-child" is FALSE.
"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.

gtk.AspectFrame Style Properties

gtk.Widget Style Properties

gtk.AspectFrame Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

Description

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.

Constructor

    gtk.AspectFrame(label=None, xalign=0.5, yalign=0.5, ratio=1.0, obey_child=TRUE)
label :a string used to set the aspect frame label
xalign :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.
yalign :The fraction of vertical free space above the child. 0.0 means no free space above, 1.0 means all free space above.
ratio :the ratio of the child width to height (in the range 0.0001 to 10000.0) if obey_child is FALSE
obey_child :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.

Methods

gtk.AspectFrame.set

    def set(xalign=0.0, yalign=0.0, ratio=1.0, obey_child=TRUE)
xalign :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.
yalign :The fraction of vertical free space above the child. 0.0 means no free space above, 1.0 means all free space above.
ratio :the ratio of the child width to height (in the range 0.0001 to 10000.0) if obey_child is FALSE
obey_child :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.