gtk.Layout
Prev | The gtk Class Reference | Next

## gtk.Layout

gtk.Layout — infinite scrollable area containing child widgets and custom drawing

## Synopsis

    class gtk.Layout(gtk.Container):
        gtk.Layout(hadjustment=None, vadjustment=None)
        def put(child_widget, x, y)
        def move(child_widget, x, y)
        def set_size(width, height)
        def get_size()
        def get_hadjustment()
        def get_vadjustment()
        def set_hadjustment(adjustment)
        def set_vadjustment(adjustment)
        def get_bin_window()

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Layout

## Implemented Interfaces

`gtk.Layout` implements `gtk.Buildable`

## gtk.Layout Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"hadjustment" | Read-Write | The `gtk.Adjustment` for the horizontal position.
"height" | Read-Write | the layout height
"vadjustment" | Read-Write | The `gtk.Adjustment` for the vertical position.
"width" | Read-Write | the layout width

## gtk.Layout Style Properties

gtk.Widget Style Properties

## gtk.Layout Child Properties

"x" | Read-Write | the X position of the child
"y" | Read-Write | the Y position of the child

## Attributes

"bin_window" | Read | the window of a layout to draw into

## gtk.Layout Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

"set-scroll-adjustments" | `def callback(`layout`, `hadjustment`, `vadjustment`, `user_param1`, `...`)`

## Description

The `gtk.Layout` is a simple container widget similar to the `gtk.Fixed` container widget. Like the `gtk.Fixed` the `gtk.Layout` places a child widget at a specific position within the container. The `gtk.Layout` offers two features beyond the `gtk.Fixed` widget:

- a very large width and height for the container - limited by the size of an unsigned integer.
- horizontal and vertical adjustments can be specified for use with scrollbars, etc.

The `gtk.Layout` can also be drawn on similar to drawing on a `gtk.DrawingArea`. When handling expose events on a `gtk.Layout`, you must draw to the window specified by the `bin_window` attribute rather than the widget `window` attribute.

## Constructor

        gtk.Layout(hadjustment=None, vadjustment=None)

`hadjustment` : | horizontal adjustment, or `None`
`vadjustment` : | vertical adjustment, or `None`
Returns : | a new `gtk.Layout`

Creates a new `gtk.Layout`. Usually the `hadjustment` and `vadjustment` arguments are not specified or are specified as `None`, so that new adjustments are created.

## Methods

### gtk.Layout.put

        def put(child_widget, x, y)

`child_widget` : | the child widget
`x` : | the X position of child widget
`y` : | the Y position of child widget

The `put`() method adds `child_widget` to the layout and places its upper, left corner at the position specified by `x` and `y`.

### gtk.Layout.move

        def move(child_widget, x, y)

`child_widget` : | a current child of the layout
`x` : | the X position to move `child_widget` to
`y` : | the Y position to move `child_widget` to

The `move`() method moves a current child of the layout (specified by `child_widget`) to the new position specified by `x` and `y`. The upper, left corner of `child_widget` will be placed at (`x`, `y`).

### gtk.Layout.set_size

        def set_size(width, height)

`width` : | width of the layout area
`height` : | height of the layout area

The `set_size`() method sets the size of the virtual area of the layout to the values specified by `width` and `height`. The "width" and "height" properties are also set by this method.

### gtk.Layout.get_size

        def get_size()

Returns : | a tuple containing the width and height set on `layout`

The `get_size`() method returns a tuple that contains the width and height of the virtual size that has been set on the layout. See `set_size`().

### gtk.Layout.get_hadjustment

        def get_hadjustment()

Returns : | a horizontal adjustment

The `get_hadjustment`() method returns the value of the "hadjustment" property that contains the horizontal adjustment object associated with the layout. This function should only be called after the layout has been placed in a `gtk.ScrolledWindow` or has otherwise been configured for scrolling. See `gtk.ScrolledWindow`, `gtk.Scrollbar`, `gtk.Adjustment` for details.

### gtk.Layout.get_vadjustment

        def get_vadjustment()

Returns : | a vertical adjustment

The `get_vadjustment`() method returns the "vadjustment" property that contains the vertical adjustment object associated with the layout. This function should only be called after the layout has been placed in a `gtk.ScrolledWindow` or has otherwise been configured for scrolling. See `gtk.ScrolledWindow`, `gtk.Scrollbar`, `gtk.Adjustment` for details.

### gtk.Layout.set_hadjustment

        def set_hadjustment(adjustment)

`adjustment` : | a horizontal adjustment

The `set_hadjustment`() method sets the horizontal adjustment for the layout (and the "hadjustment" property) to the value of `adjustment`. See `gtk.ScrolledWindow`, `gtk.Scrollbar`, `gtk.Adjustment` for details.

### gtk.Layout.set_vadjustment

        def set_vadjustment(adjustment)

`adjustment` : | a vertical adjustment

The `set_vadjustment`() method sets the vertical adjustment for the layout (and the "vadjustment" property) to the value of `adjustment`. See `gtk.ScrolledWindow`, `gtk.Scrollbar`, `gtk.Adjustment` for details.

### gtk.Layout.get_bin_window

        def get_bin_window()

Returns : | a `gtk.gdk.Window`.

### Note

This method is available in PyGTK 2.14 and above.

The `get_bin_window`() method retrieve the bin window of the layout used for drawing operations.

## Signals

### The "set-scroll-adjustments" gtk.Layout Signal

        def callback(layout, hadjustment, vadjustment, user_param1, ...)

`layout` : | the layout that received the signal
`hadjustment` : | the horizontal adjustment associated with the layout.
`vadjustment` : | the horizontal adjustment associated with the layout.
`user_param1` : | the first user parameter (if any) specified with the `connect`() method
`...` : | additional user parameters (if any)

The "set-scroll-adjustments" signal is emitted when one of the adjustments associated with a layout is changed.

Prev | Up | Next
gtk.Label | Home | gtk.LinkButton