Gtk.Viewport

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.Bin Gtk.Bin Gtk.Viewport Gtk.Viewport Gtk.Bin->Gtk.Viewport Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Scrollable->Gtk.Viewport Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Bin (1), 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_shadow_type ()

get_vadjustment ()

get_view_window ()

set_hadjustment (adjustment)

set_shadow_type (type)

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

shadow-type

Gtk.ShadowType

r/w/en

Determines how the shadowed box around the viewport is drawn

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.Viewport(*args, **kwargs)
Bases:

Gtk.Bin, Gtk.Scrollable

Abstract:

No

Structure:

Gtk.ViewportClass

The Gtk.Viewport widget acts as an adaptor class, implementing scrollability for child widgets that lack their own scrolling capabilities. Use Gtk.Viewport to scroll child widgets such as Gtk.Grid, Gtk.Box, and so on.

If a widget has native scrolling abilities, such as Gtk.TextView, Gtk.TreeView or Gtk.IconView, it can be added to a Gtk.ScrolledWindow with Gtk.Container.add(). If a widget does not, you must first add the widget to a Gtk.Viewport, then add the viewport to the scrolled window. Gtk.Container.add() does this automatically if a child that does not implement Gtk.Scrollable is added to a Gtk.ScrolledWindow, so you can ignore the presence of the viewport.

The Gtk.Viewport will start scrolling content only if allocated less than the child widget’s minimum size in a given orientation.

CSS nodes

Gtk.Viewport has a single CSS node with name viewport.

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

a new Gtk.Viewport

Return type:

Gtk.Widget

Creates a new Gtk.Viewport with the given adjustments, or with default adjustments if none are given.

get_bin_window()[source]
Returns:

a Gdk.Window

Return type:

Gdk.Window

Gets the bin window of the Gtk.Viewport.

New in version 2.20.

get_hadjustment()[source]
Returns:

the horizontal adjustment of self.

Return type:

Gtk.Adjustment

Returns the horizontal adjustment of the viewport.

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

get_shadow_type()[source]
Returns:

the shadow type

Return type:

Gtk.ShadowType

Gets the shadow type of the Gtk.Viewport. See Gtk.Viewport.set_shadow_type().

get_vadjustment()[source]
Returns:

the vertical adjustment of self.

Return type:

Gtk.Adjustment

Returns the vertical adjustment of the viewport.

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

get_view_window()[source]
Returns:

a Gdk.Window

Return type:

Gdk.Window

Gets the view window of the Gtk.Viewport.

New in version 2.22.

set_hadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – a Gtk.Adjustment.

Sets the horizontal adjustment of the viewport.

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

set_shadow_type(type)[source]
Parameters:

type (Gtk.ShadowType) – the new shadow type.

Sets the shadow type of the viewport.

set_vadjustment(adjustment)[source]
Parameters:

adjustment (Gtk.Adjustment or None) – a Gtk.Adjustment.

Sets the vertical adjustment of the viewport.

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

Property Details

Gtk.Viewport.props.shadow_type
Name:

shadow-type

Type:

Gtk.ShadowType

Default Value:

Gtk.ShadowType.IN

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines how the shadowed box around the viewport is drawn