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.

Parameters:

**kwargs -- Properties to set.

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],
)
gproperty child: list[StackPage]#
  • 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.

Parameters:
  • title (str) -- The title. It will be used by StackSwitcher to display child in a tab bar.

  • child (Widget) -- The child widget.

Warning

It is not a widget.

gproperty title: str#
  • read-only

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

gproperty child: gi.repository.Gtk.Widget#
  • 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.

Parameters:

**kwargs -- Properties to set.