Gtk.Layout

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 Gtk.Scrollable Gtk.Scrollable GObject.GInterface->Gtk.Scrollable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Layout Gtk.Layout Gtk.Container->Gtk.Layout Gtk.Scrollable->Gtk.Layout Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Scrollable (9)

Structs:

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

class

new (hadjustment, vadjustment)

get_bin_window ()

get_hadjustment ()

get_size ()

get_vadjustment ()

move (child_widget, x, y)

put (child_widget, x, y)

set_hadjustment (adjustment)

set_size (width, height)

set_vadjustment (adjustment)

Virtual Methods

Inherited:

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

Properties

Inherited:

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

Name

Type

Flags

Short Description

height

int

r/w/en

The height of the layout

width

int

r/w/en

The width of the layout

Child Properties

Name

Type

Default

Flags

Short Description

x

int

0

r/w

X position of child widget

y

int

0

r/w

Y position of child widget

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

container

Gtk.Container

r

Class Details

class Gtk.Layout(**kwargs)
Bases:

Gtk.Container, Gtk.Scrollable

Abstract:

No

Structure:

Gtk.LayoutClass

Gtk.Layout is similar to Gtk.DrawingArea in that it’s a “blank slate” and doesn’t do anything except paint a blank background by default. It’s different in that it supports scrolling natively due to implementing Gtk.Scrollable, and can contain child widgets since it’s a Gtk.Container.

If you just want to draw, a Gtk.DrawingArea is a better choice since it has lower overhead. If you just need to position child widgets at specific points, then Gtk.Fixed provides that functionality on its own.

When handling expose events on a Gtk.Layout, you must draw to the Gdk.Window returned by Gtk.Layout.get_bin_window(), rather than to the one returned by Gtk.Widget.get_window() as you would for a Gtk.DrawingArea.

classmethod new(hadjustment, vadjustment)[source]
Parameters:
Returns:

a new Gtk.Layout

Return type:

Gtk.Widget

Creates a new Gtk.Layout. Unless you have a specific adjustment you’d like the layout to use for scrolling, pass None for hadjustment and vadjustment.

get_bin_window()[source]
Returns:

a Gdk.Window

Return type:

Gdk.Window

Retrieve the bin window of the layout used for drawing operations.

New in version 2.14.

get_hadjustment()[source]
Returns:

horizontal scroll adjustment

Return type:

Gtk.Adjustment

This function should only be called after the layout has been placed in a Gtk.ScrolledWindow or otherwise configured for scrolling. It returns the Gtk.Adjustment used for communication between the horizontal scrollbar and self.

See Gtk.ScrolledWindow, Gtk.Scrollbar, Gtk.Adjustment for details.

Deprecated since version 3.0: Use Gtk.Scrollable.get_hadjustment()

get_size()[source]
Returns:

width:

location to store the width set on self, or None

height:

location to store the height set on self, or None

Return type:

(width: int, height: int)

Gets the size that has been set on the layout, and that determines the total extents of the layout’s scrollbar area. See Gtk.Layout.set_size ().

get_vadjustment()[source]
Returns:

vertical scroll adjustment

Return type:

Gtk.Adjustment

This function should only be called after the layout has been placed in a Gtk.ScrolledWindow or otherwise configured for scrolling. It returns the Gtk.Adjustment used for communication between the vertical scrollbar and self.

See Gtk.ScrolledWindow, Gtk.Scrollbar, Gtk.Adjustment for details.

Deprecated since version 3.0: Use Gtk.Scrollable.get_vadjustment()

move(child_widget, x, y)[source]
Parameters:
  • child_widget (Gtk.Widget) – a current child of self

  • x (int) – X position to move to

  • y (int) – Y position to move to

Moves a current child of self to a new position.

put(child_widget, x, y)[source]
Parameters:
  • child_widget (Gtk.Widget) – child widget

  • x (int) – X position of child widget

  • y (int) – Y position of child widget

Adds child_widget to self, at position (x,`y`). self becomes the new parent container of child_widget.

set_hadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – new scroll adjustment

Sets the horizontal scroll adjustment for the layout.

See Gtk.ScrolledWindow, Gtk.Scrollbar, Gtk.Adjustment for details.

Deprecated since version 3.0: Use Gtk.Scrollable.set_hadjustment()

set_size(width, height)[source]
Parameters:
  • width (int) – width of entire scrollable area

  • height (int) – height of entire scrollable area

Sets the size of the scrollable area of the layout.

set_vadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – new scroll adjustment

Sets the vertical scroll adjustment for the layout.

See Gtk.ScrolledWindow, Gtk.Scrollbar, Gtk.Adjustment for details.

Deprecated since version 3.0: Use Gtk.Scrollable.set_vadjustment()

Property Details

Gtk.Layout.props.height
Name:

height

Type:

int

Default Value:

100

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The height of the layout

Gtk.Layout.props.width
Name:

width

Type:

int

Default Value:

100

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The width of the layout