Stack#

class ignis.widgets.Widget.Stack(*args: Any, **kwargs: Any)#

Bases: Gtk.Stack

Stack is a container which only shows one of its children at a time.

It does not provide a means for users to change the visible child. Instead, a separate widget such as StackSwitcher can be used with Stack to provide this functionality.

Overrided properties:
  • transition_type: The type of animation used to transition between pages. Available values: Gtk.StackTransitionType.

from ignis.widgets import Widget

stack = Widget.Stack(
    child=[
        Widget.StackPage(
            title="page 1", child=Widget.Label(label="welcome to page 1!")
        ),
        Widget.StackPage(
            title="page 2", child=Widget.Label(label="welcome to page 2!")
        ),
        Widget.StackPage(
            title="page 3", child=Widget.Label(label="welcome to page 3!")
        ),
    ]
)

Widget.Box(
    vertical=True,
    # you should add both StackSwitcher and Stack.
    child=[Widget.StackSwitcher(stack=stack), stack],
)
property child: list[StackPage]#
  • optional, read-write

A list of pages.

class ignis.widgets.Widget.StackPage(title: str, child: gi.repository.Gtk.Widget)#

Bases: IgnisGObject

Intented to use with Stack.

Warning

It is not a widget.

property title: str#
  • required, read-only

The title. It will be used by StackSwitcher to display child in a tab bar.

property child: gi.repository.Gtk.Widget#
  • required, read-only

The child widget.

class ignis.widgets.Widget.StackSwitcher(*args: Any, **kwargs: Any)#

Bases: Gtk.StackSwitcher

The StackSwitcher shows a row of buttons to switch between Stack pages.