Gtk.StackSwitcher

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.StackSwitcher Gtk.StackSwitcher Gtk.Orientable->Gtk.StackSwitcher Gtk.Widget->Gtk.StackSwitcher

Example

../_images/StackSwitcher.png
Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Gtk.Orientable (2)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

get_stack ()

set_stack (stack)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1), Gtk.Orientable (1)

Name

Type

Flags

Short Description

stack

Gtk.Stack

r/w/c

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.StackSwitcher(**kwargs)
Bases:

Gtk.Widget, Gtk.Orientable

Abstract:

No

The GtkStackSwitcher shows a row of buttons to switch between GtkStack pages.

An example Gtk.StackSwitcher

It acts as a controller for the associated GtkStack.

All the content for the buttons comes from the properties of the stacks [class`Gtk`.StackPage] objects; the button visibility in a GtkStackSwitcher widget is controlled by the visibility of the child in the GtkStack.

It is possible to associate multiple GtkStackSwitcher widgets with the same GtkStack widget.

CSS nodes

GtkStackSwitcher has a single CSS node named stackswitcher and style class .stack-switcher.

When circumstances require it, GtkStackSwitcher adds the .needs-attention style class to the widgets representing the stack pages.

Accessibility

GtkStackSwitcher uses the Gtk.AccessibleRole.TAB_LIST role and uses the Gtk.AccessibleRole.TAB for its buttons.

Orientable

Since GTK 4.4, GtkStackSwitcher implements GtkOrientable allowing the stack switcher to be made vertical with gtk_orientable_set_orientation().

classmethod new()[source]
Returns:

a new GtkStackSwitcher.

Return type:

Gtk.Widget

Create a new GtkStackSwitcher.

get_stack()[source]
Returns:

the stack

Return type:

Gtk.Stack or None

Retrieves the stack.

set_stack(stack)[source]
Parameters:

stack (Gtk.Stack or None) – a GtkStack

Sets the stack to control.

Property Details

Gtk.StackSwitcher.props.stack
Name:

stack

Type:

Gtk.Stack

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

The stack.