gtk.Viewport
Prev | The gtk Class Reference | Next

## gtk.Viewport

gtk.Viewport — a widget displaying a portion of a larger widget.

## Synopsis

    class gtk.Viewport(gtk.Bin):
        gtk.Viewport(hadjustment=None, vadjustment=None)
        def get_hadjustment()
        def get_vadjustment()
        def set_hadjustment(adjustment)
        def set_vadjustment(adjustment)
        def set_shadow_type(type)
        def get_shadow_type()
        def get_bin_window()
        def get_view_window()

## Ancestry

    +-- gobject.GObject
      +-- gtk.Object
        +-- gtk.Widget
          +-- gtk.Container
            +-- gtk.Bin
              +-- gtk.Viewport

## Implemented Interfaces

`gtk.Viewport` implements `gtk.Buildable`

## gtk.Viewport Properties

gtk.Object Properties

gtk.Widget Properties

gtk.Container Properties

"hadjustment" | Read-Write | The `gtk.Adjustment` that determines the values of the horizontal position for this viewport.
"shadow-type" | Read-Write | The type of shadowed box around the viewport: `gtk.SHADOW_NONE`, `gtk.SHADOW_IN`, `gtk.SHADOW_OUT`, `gtk.SHADOW_ETCHED_IN` or `gtk.SHADOW_ETCHED_OUT`
"vadjustment" | Read-Write | The `gtk.Adjustment` that determines the values of the vertical position for this viewport.

## gtk.Viewport Style Properties

gtk.Widget Style Properties

## gtk.Viewport Signal Prototypes

gobject.GObject Signal Prototypes

gtk.Object Signal Prototypes

gtk.Widget Signal Prototypes

gtk.Container Signal Prototypes

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

## Description

A `gtk.Viewport` widget provides a view into a portion of a larger widget. A `gtk.Viewport` is usually used to provide adjustment capability for a widget to be used in a `gtk.ScrolledWindow`. For example, a label widget doesn't have any adjustments (does not support the "set-scroll-adjustments" signal) and would need a viewport when added to a `gtk.ScrolledWindow` to make the scrollbars functional. See the `gtk.ScrolledWindow.add_with_viewport`() method for more information.

## Constructor

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

`hadjustment` : | a horizontal adjustment.
`vadjustment` : | a vertical adjustment.
Returns : | a new `gtk.Viewport` widget

Creates a new `gtk.Viewport` with the horizontal and vertical adjustments specified by `hadjustment` and `vadjustment` respectively. If `hadjustment` or `vadjustment` is `None` a new adjustment will be created.

## Methods

### gtk.Viewport.get_hadjustment

        def get_hadjustment()

Returns : | the horizontal adjustment

The `get_hadjustment`() method returns the value of the "hadjustment" property that contains the horizontal `gtk.Adjustment` of the viewport.

### gtk.Viewport.get_vadjustment

        def get_vadjustment()

Returns : | the vertical adjustment

The `get_vadjustment`() method returns the value of the "vadjustment" property that contains the vertical `gtk.Adjustment` of the viewport.

### gtk.Viewport.set_hadjustment

        def set_hadjustment(adjustment)

`adjustment` : | a `gtk.Adjustment`.

The `set_hadjustment`() method sets the "hadjustment" property to the value of `adjustment` that becomes the horizontal adjustment of the viewport.

### gtk.Viewport.set_vadjustment

        def set_vadjustment(adjustment)

`adjustment` : | a `gtk.Adjustment`.

The `set_vadjustment`() method sets the "vadjustment" property to the value of `adjustment` that becomes the vertical adjustment of the viewport.

### gtk.Viewport.set_shadow_type

        def set_shadow_type(type)

`type` : | the new shadow type.

The `set_shadow_type`() method sets the "shadow-type" property to the value of `type`. The value of `type` must be one of:

- `gtk.SHADOW_NONE`
- `gtk.SHADOW_IN`
- `gtk.SHADOW_OUT`
- `gtk.SHADOW_ETCHED_IN`
- `gtk.SHADOW_ETCHED_OUT`

### gtk.Viewport.get_shadow_type

        def get_shadow_type()

Returns : | the shadow type

The `get_shadow_type`() method returns the value of the "shadow-type" property that contains the shadow type of the `gtk.Viewport`. See the `set_shadow_type`() method for more information.

### gtk.Viewport.get_bin_window

        def get_bin_window()

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

### Note

This method is available in PyGTK 2.22 and above.

The `get_bin_window`() method gets the bin window of the viewport.

### gtk.Viewport.get_view_window

        def get_view_window()

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

### Note

This method is available in PyGTK 2.22 and above.

The `get_view_window`() method gets the view window of the viewport.

## Signals

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

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

`viewport` : | the viewport that received the signal
`hadjustment` : | the horizontal `gtk.Adjustment`
`vadjustment` : | the vertical `gtk.Adjustment`
`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 or both of the horizontal and vertical `gtk.Adjustment` objects is changed.

Prev | Up | Next
gtk.VSeparator | Home | gtk.Widget