ViewStack
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
- Constructors:
ViewStack(**properties)
new() -> Gtk.Widget
Constructors
Methods
- class ViewStack
- add(child: Widget) ViewStackPage
Adds a child to
self
.- Parameters:
child – the widget to add
- add_named(child: Widget, name: str | None = None) ViewStackPage
Adds a child to
self
.The child is identified by the
name
.- Parameters:
child – the widget to add
name – the name for
child
- add_titled(child: Widget, name: str | None, title: str) ViewStackPage
Adds a child to
self
.The child is identified by the
name
. Thetitle
will be used byViewSwitcher
to representchild
, so it should be short.- Parameters:
child – the widget to add
name – the name for
child
title – a human-readable title for
child
- add_titled_with_icon(child: Widget, name: str | None, title: str, icon_name: str) ViewStackPage
Adds a child to
self
.The child is identified by the
name
. Thetitle
andicon_name
will be used byViewSwitcher
to representchild
.Added in version 1.2.
- Parameters:
child – the widget to add
name – the name for
child
title – a human-readable title for
child
icon_name – an icon name for
child
- get_child_by_name(name: str) Widget | None
Finds the child with
name
inself
.- Parameters:
name – the name of the child to find
- get_page(child: Widget) ViewStackPage
Gets the
ViewStackPage
object forchild
.- Parameters:
child – a child of
self
- get_pages() SelectionModel
Returns a
ListModel
that contains the pages of the stack.This can be used to keep an up-to-date view. The model also implements
SelectionModel
and can be used to track and change the visible page.
- remove(child: Widget) None
Removes a child widget from
self
.- Parameters:
child – the child to remove
- set_hhomogeneous(hhomogeneous: bool) None
Sets
self
to be horizontally homogeneous or not.If the stack is horizontally homogeneous, it allocates the same width for all children.
If it’s
FALSE
, the stack may change width when a different child becomes visible.- Parameters:
hhomogeneous – whether to make
self
horizontally homogeneous
- set_vhomogeneous(vhomogeneous: bool) None
Sets
self
to be vertically homogeneous or not.If the stack is vertically homogeneous, it allocates the same height for all children.
If it’s
FALSE
, the stack may change height when a different child becomes visible.- Parameters:
vhomogeneous – whether to make
self
vertically homogeneous
- set_visible_child(child: Widget) None
Makes
child
the visible child ofself
.- Parameters:
child – a child of
self
- set_visible_child_name(name: str) None
Makes the child with
name
visible.See
visible_child
.- Parameters:
name – the name of the child
Properties
- class ViewStack
- props.hhomogeneous: bool
Whether the stack is horizontally homogeneous.
If the stack is horizontally homogeneous, it allocates the same width for all children.
If it’s
FALSE
, the stack may change width when a different child becomes visible.
- props.pages: SelectionModel
A selection model with the stack’s pages.
This can be used to keep an up-to-date view. The model also implements
SelectionModel
and can be used to track and change the visible page.
- props.vhomogeneous: bool
Whether the stack is vertically homogeneous.
If the stack is vertically homogeneous, it allocates the same height for all children.
If it’s
FALSE
, the stack may change height when a different child becomes visible.
- props.visible_child_name: str
The name of the widget currently visible in the stack.
See
visible_child
.