:right-sidebar: True StackSwitcher =================================================================== .. currentmodule:: gi.repository.Gtk .. class:: StackSwitcher(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget`, :class:`~gi.repository.Gtk.Orientable` The ``GtkStackSwitcher`` shows a row of buttons to switch between ``GtkStack`` pages. .. image:: https://docs.gtk.org/gtk4/stackswitcher.png It acts as a controller for the associated ``GtkStack``. All the content for the buttons comes from the properties of the stacks :obj:`~gi.repository.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 :const:`~gi.repository.Gtk.AccessibleRole.TAB_LIST` role and uses the :const:`~gi.repository.Gtk.AccessibleRole.TAB` for its buttons. Orientable ---------- Since GTK 4.4, ``GtkStackSwitcher`` implements ``GtkOrientable`` allowing the stack switcher to be made vertical with ``:func:`~gi.repository.Gtk.Orientable.set_orientation```. Constructors ------------ .. rst-class:: interim-class .. class:: StackSwitcher :no-index: .. classmethod:: new() -> ~gi.repository.Gtk.Widget Create a new ``GtkStackSwitcher``. Methods ------- .. rst-class:: interim-class .. class:: StackSwitcher :no-index: .. method:: get_stack() -> ~gi.repository.Gtk.Stack | None Retrieves the stack. .. method:: set_stack(stack: ~gi.repository.Gtk.Stack | None = None) -> None Sets the stack to control. :param stack: a ``GtkStack`` Properties ---------- .. rst-class:: interim-class .. class:: StackSwitcher :no-index: .. attribute:: props.stack :type: ~gi.repository.Gtk.Stack The stack.