Gtk.Alignment

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Alignment Gtk.Alignment Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Alignment Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new (xalign, yalign, xscale, yscale)

get_padding ()

set (xalign, yalign, xscale, yscale)

set_padding (padding_top, padding_bottom, padding_left, padding_right)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39)

Name

Type

Flags

Short Description

bottom-padding

int

d/r/w

The padding to insert at the bottom of the widget. deprecated

left-padding

int

d/r/w

The padding to insert at the left of the widget. deprecated

right-padding

int

d/r/w

The padding to insert at the right of the widget. deprecated

top-padding

int

d/r/w

The padding to insert at the top of the widget. deprecated

xalign

float

d/r/w

Horizontal position of child in available space. 0.0 is left aligned, 1.0 is right aligned deprecated

xscale

float

d/r/w

If available horizontal space is bigger than needed for the child, how much of it to use for the child. 0.0 means none, 1.0 means all deprecated

yalign

float

d/r/w

Vertical position of child in available space. 0.0 is top aligned, 1.0 is bottom aligned deprecated

yscale

float

d/r/w

If available vertical space is bigger than needed for the child, how much of it to use for the child. 0.0 means none, 1.0 means all deprecated

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

bin

Gtk.Bin

r

Class Details

class Gtk.Alignment(**kwargs)
Bases:

Gtk.Bin

Abstract:

No

Structure:

Gtk.AlignmentClass

The Gtk.Alignment widget controls the alignment and size of its child widget. It has four settings: xscale, yscale, xalign, and yalign.

The scale settings are used to specify how much the child widget should expand to fill the space allocated to the Gtk.Alignment. The values can range from 0 (meaning the child doesn’t expand at all) to 1 (meaning the child expands to fill all of the available space).

The align settings are used to place the child widget within the available area. The values range from 0 (top or left) to 1 (bottom or right). Of course, if the scale settings are both set to 1, the alignment settings have no effect.

Gtk.Alignment has been deprecated in 3.14 and should not be used in newly-written code. The desired effect can be achieved by using the Gtk.Widget :halign, Gtk.Widget :valign and Gtk.Widget :margin properties on the child widget.

classmethod new(xalign, yalign, xscale, yscale)[source]
Parameters:
  • xalign (float) – the horizontal alignment of the child widget, from 0 (left) to 1 (right).

  • yalign (float) – the vertical alignment of the child widget, from 0 (top) to 1 (bottom).

  • xscale (float) – the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the Gtk.Alignment.

  • yscale (float) – the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

Returns:

the new Gtk.Alignment

Return type:

Gtk.Widget

Creates a new Gtk.Alignment.

Deprecated since version 3.14: Use Gtk.Widget alignment and margin properties

get_padding()[source]
Returns:

padding_top:

location to store the padding for the top of the widget, or None

padding_bottom:

location to store the padding for the bottom of the widget, or None

padding_left:

location to store the padding for the left of the widget, or None

padding_right:

location to store the padding for the right of the widget, or None

Return type:

(padding_top: int, padding_bottom: int, padding_left: int, padding_right: int)

Gets the padding on the different sides of the widget. See Gtk.Alignment.set_padding ().

New in version 2.4.

Deprecated since version 3.14: Use Gtk.Widget alignment and margin properties

set(xalign, yalign, xscale, yscale)[source]
Parameters:
  • xalign (float) – the horizontal alignment of the child widget, from 0 (left) to 1 (right).

  • yalign (float) – the vertical alignment of the child widget, from 0 (top) to 1 (bottom).

  • xscale (float) – the amount that the child widget expands horizontally to fill up unused space, from 0 to 1. A value of 0 indicates that the child widget should never expand. A value of 1 indicates that the child widget will expand to fill all of the space allocated for the Gtk.Alignment.

  • yscale (float) – the amount that the child widget expands vertically to fill up unused space, from 0 to 1. The values are similar to xscale.

Sets the Gtk.Alignment values.

Deprecated since version 3.14: Use Gtk.Widget alignment and margin properties

set_padding(padding_top, padding_bottom, padding_left, padding_right)[source]
Parameters:
  • padding_top (int) – the padding at the top of the widget

  • padding_bottom (int) – the padding at the bottom of the widget

  • padding_left (int) – the padding at the left of the widget

  • padding_right (int) – the padding at the right of the widget.

Sets the padding on the different sides of the widget. The padding adds blank space to the sides of the widget. For instance, this can be used to indent the child widget towards the right by adding padding on the left.

New in version 2.4.

Deprecated since version 3.14: Use Gtk.Widget alignment and margin properties

Property Details

Gtk.Alignment.props.bottom_padding
Name:

bottom-padding

Type:

int

Default Value:

0

Flags:

DEPRECATED, READABLE, WRITABLE

The padding to insert at the bottom of the widget.

New in version 2.4.

Deprecated since version 3.14: Use Gtk.Widget.set_margin_bottom() instead

Gtk.Alignment.props.left_padding
Name:

left-padding

Type:

int

Default Value:

0

Flags:

DEPRECATED, READABLE, WRITABLE

The padding to insert at the left of the widget.

New in version 2.4.

Deprecated since version 3.14: Use Gtk.Widget.set_margin_start() instead

Gtk.Alignment.props.right_padding
Name:

right-padding

Type:

int

Default Value:

0

Flags:

DEPRECATED, READABLE, WRITABLE

The padding to insert at the right of the widget.

New in version 2.4.

Deprecated since version 3.14: Use Gtk.Widget.set_margin_end() instead

Gtk.Alignment.props.top_padding
Name:

top-padding

Type:

int

Default Value:

0

Flags:

DEPRECATED, READABLE, WRITABLE

The padding to insert at the top of the widget.

New in version 2.4.

Deprecated since version 3.14: Use Gtk.Widget.set_margin_top() instead

Gtk.Alignment.props.xalign
Name:

xalign

Type:

float

Default Value:

0.5

Flags:

DEPRECATED, READABLE, WRITABLE

Horizontal position of child in available space. A value of 0.0 will flush the child left (or right, in RTL locales); a value of 1.0 will flush the child right (or left, in RTL locales).

Deprecated since version 3.14: Use Gtk.Widget.set_halign() on the child instead

Gtk.Alignment.props.xscale
Name:

xscale

Type:

float

Default Value:

1.0

Flags:

DEPRECATED, READABLE, WRITABLE

If available horizontal space is bigger than needed, how much of it to use for the child. A value of 0.0 means none; a value of 1.0 means all.

Deprecated since version 3.14: Use Gtk.Widget.set_hexpand() on the child instead

Gtk.Alignment.props.yalign
Name:

yalign

Type:

float

Default Value:

0.5

Flags:

DEPRECATED, READABLE, WRITABLE

Vertical position of child in available space. A value of 0.0 will flush the child to the top; a value of 1.0 will flush the child to the bottom.

Deprecated since version 3.14: Use Gtk.Widget.set_valign() on the child instead

Gtk.Alignment.props.yscale
Name:

yscale

Type:

float

Default Value:

1.0

Flags:

DEPRECATED, READABLE, WRITABLE

If available vertical space is bigger than needed, how much of it to use for the child. A value of 0.0 means none; a value of 1.0 means all.

Deprecated since version 3.14: Use Gtk.Widget.set_vexpand() on the child instead