Gtk.Stack¶
Methods¶
| Inherited: | Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10) | 
|---|---|
| Structs: | Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5) | 
| class | new() | 
| add_named(child, name) | |
| add_titled(child, name, title) | |
| get_child_by_name(name) | |
| get_hhomogeneous() | |
| get_homogeneous() | |
| get_interpolate_size() | |
| get_transition_duration() | |
| get_transition_running() | |
| get_transition_type() | |
| get_vhomogeneous() | |
| get_visible_child() | |
| get_visible_child_name() | |
| set_hhomogeneous(hhomogeneous) | |
| set_homogeneous(homogeneous) | |
| set_interpolate_size(interpolate_size) | |
| set_transition_duration(duration) | |
| set_transition_type(transition) | |
| set_vhomogeneous(vhomogeneous) | |
| set_visible_child(child) | |
| set_visible_child_full(name, transition) | |
| set_visible_child_name(name) | 
Virtual Methods¶
| Inherited: | Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10) | 
|---|
Properties¶
| Inherited: | Gtk.Container (3), Gtk.Widget (39) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| hhomogeneous | bool | r/w/en | Horizontally homogeneous sizing | 
| homogeneous | bool | r/w/en | Homogeneous sizing | 
| interpolate-size | bool | r/w/en | Whether or not the size should smoothly change when changing between differently sized children | 
| transition-duration | int | r/w/en | The animation duration, in milliseconds | 
| transition-running | bool | r | Whether or not the transition is currently running | 
| transition-type | Gtk.StackTransitionType | r/w/en | The type of animation used to transition | 
| vhomogeneous | bool | r/w/en | Vertically homogeneous sizing | 
| visible-child | Gtk.Widget | r/w/en | The widget currently visible in the stack | 
| visible-child-name | str | r/w/en | The name of the widget currently visible in the stack | 
Child Properties¶
| Name | Type | Default | Flags | Short Description | 
|---|---|---|---|---|
| icon-name | str | None | r/w | The icon name of the child page | 
| name | str | None | r/w | The name of the child page | 
| needs-attention | bool | False | r/w | Whether this page needs attention | 
| position | int | 0 | r/w | The index of the child in the parent | 
| title | str | None | r/w | The title of the child page | 
Style Properties¶
| Inherited: | Gtk.Widget (17) | 
|---|
Signals¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
Fields¶
| Inherited: | Gtk.Container (4), Gtk.Widget (69), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent_instance | Gtk.Container | r | 
Class Details¶
- 
class Gtk.Stack(**kwargs)¶
- Bases: - Gtk.Container- Abstract: - No - Structure: - Gtk.StackClass- The - Gtk.Stackwidget is a container which only shows one of its children at a time. In contrast to- Gtk.Notebook,- Gtk.Stackdoes not provide a means for users to change the visible child. Instead, the- Gtk.StackSwitcherwidget can be used with- Gtk.Stackto provide this functionality.- Transitions between pages can be animated as slides or fades. This can be controlled with - Gtk.Stack.set_transition_type(). These animations respect the- Gtk.Settings- :gtk-enable-animationssetting.- The - Gtk.Stackwidget was added in GTK+ 3.10.- CSS nodes
 - Gtk.Stackhas a single CSS node named stack.- 
classmethod new()[source]¶
- Returns: - a new - Gtk.Stack- Return type: - Gtk.Widget- Creates a new - Gtk.Stackcontainer.- New in version 3.10. 
 - 
add_named(child, name)[source]¶
- Parameters: - child (Gtk.Widget) – the widget to add
- name (str) – the name for child
 - Adds a child to self. The child is identified by the name. - New in version 3.10. 
- child (
 - 
add_titled(child, name, title)[source]¶
- Parameters: - child (Gtk.Widget) – the widget to add
- name (str) – the name for child
- title (str) – a human-readable title for child
 - Adds a child to self. The child is identified by the name. The title will be used by - Gtk.StackSwitcherto represent child in a tab bar, so it should be short.- New in version 3.10. 
- child (
 - 
get_child_by_name(name)[source]¶
- Parameters: - name ( - str) – the name of the child to find- Returns: - the requested child of the - Gtk.Stack- Return type: - Gtk.Widgetor- None- Finds the child of the - Gtk.Stackwith the name given as the argument. Returns- Noneif there is no child with this name.- New in version 3.12. 
 - 
get_hhomogeneous()[source]¶
- Returns: - whether self is horizontally homogeneous. - Return type: - bool- Gets whether self is horizontally homogeneous. See - Gtk.Stack.set_hhomogeneous().- New in version 3.16. 
 - 
get_homogeneous()[source]¶
- Returns: - whether self is homogeneous. - Return type: - bool- Gets whether self is homogeneous. See - Gtk.Stack.set_homogeneous().- New in version 3.10. 
 - 
get_interpolate_size()[source]¶
- Returns: - Trueif child sizes are interpolated- Return type: - bool- Returns wether the - Gtk.Stackis set up to interpolate between the sizes of children on page switch.- New in version 3.18. 
 - 
get_transition_duration()[source]¶
- Returns: - the transition duration - Return type: - int- Returns the amount of time (in milliseconds) that transitions between pages in self will take. - New in version 3.10. 
 - 
get_transition_running()[source]¶
- Returns: - Trueif the transition is currently running,- Falseotherwise.- Return type: - bool- Returns whether the self is currently in a transition from one page to another. - New in version 3.12. 
 - 
get_transition_type()[source]¶
- Returns: - the current transition type of self - Return type: - Gtk.StackTransitionType- Gets the type of animation that will be used for transitions between pages in self. - New in version 3.10. 
 - 
get_vhomogeneous()[source]¶
- Returns: - whether self is vertically homogeneous. - Return type: - bool- Gets whether self is vertically homogeneous. See - Gtk.Stack.set_vhomogeneous().- New in version 3.16. 
 - 
get_visible_child()[source]¶
- Returns: - the visible child of the - Gtk.Stack- Return type: - Gtk.Widgetor- None- Gets the currently visible child of self, or - Noneif there are no visible children.- New in version 3.10. 
 - 
get_visible_child_name()[source]¶
- Returns: - the name of the visible child of the - Gtk.Stack- Return type: - stror- None- Returns the name of the currently visible child of self, or - Noneif there is no visible child.- New in version 3.10. 
 - 
set_hhomogeneous(hhomogeneous)[source]¶
- Parameters: - hhomogeneous ( - bool) –- Trueto make self horizontally homogeneous- Sets the - Gtk.Stackto be horizontally homogeneous or not. If it is homogeneous, the- Gtk.Stackwill request the same width for all its children. If it isn’t, the stack may change width when a different child becomes visible.- New in version 3.16. 
 - 
set_homogeneous(homogeneous)[source]¶
- Parameters: - homogeneous ( - bool) –- Trueto make self homogeneous- Sets the - Gtk.Stackto be homogeneous or not. If it is homogeneous, the- Gtk.Stackwill request the same size for all its children. If it isn’t, the stack may change size when a different child becomes visible.- Since 3.16, homogeneity can be controlled separately for horizontal and vertical size, with the - Gtk.Stack- :hhomogeneousand- Gtk.Stack- :vhomogeneous.- New in version 3.10. 
 - 
set_interpolate_size(interpolate_size)[source]¶
- Parameters: - interpolate_size ( - bool) – the new value- Sets whether or not self will interpolate its size when changing the visible child. If the - Gtk.Stack- :interpolate-sizeproperty is set to- True, self will interpolate its size between the current one and the one it’ll take after changing the visible child, according to the set transition duration.- New in version 3.18. 
 - 
set_transition_duration(duration)[source]¶
- Parameters: - duration ( - int) – the new duration, in milliseconds- Sets the duration that transitions between pages in self will take. - New in version 3.10. 
 - 
set_transition_type(transition)[source]¶
- Parameters: - transition ( - Gtk.StackTransitionType) – the new transition type- Sets the type of animation that will be used for transitions between pages in self. Available types include various kinds of fades and slides. - The transition type can be changed without problems at runtime, so it is possible to change the animation based on the page that is about to become current. - New in version 3.10. 
 - 
set_vhomogeneous(vhomogeneous)[source]¶
- Parameters: - vhomogeneous ( - bool) –- Trueto make self vertically homogeneous- Sets the - Gtk.Stackto be vertically homogeneous or not. If it is homogeneous, the- Gtk.Stackwill request the same height for all its children. If it isn’t, the stack may change height when a different child becomes visible.- New in version 3.16. 
 - 
set_visible_child(child)[source]¶
- Parameters: - child ( - Gtk.Widget) – a child of self- Makes child the visible child of self. - If child is different from the currently visible child, the transition between the two will be animated with the current transition type of self. - Note that the child widget has to be visible itself (see - Gtk.Widget.show()) in order to become the visible child of self.- New in version 3.10. 
 - 
set_visible_child_full(name, transition)[source]¶
- Parameters: - name (str) – the name of the child to make visible
- transition (Gtk.StackTransitionType) – the transition type to use
 - Makes the child with the given name visible. - Note that the child widget has to be visible itself (see - Gtk.Widget.show()) in order to become the visible child of self.- New in version 3.10. 
- name (
 - 
set_visible_child_name(name)[source]¶
- Parameters: - name ( - str) – the name of the child to make visible- Makes the child with the given name visible. - If child is different from the currently visible child, the transition between the two will be animated with the current transition type of self. - Note that the child widget has to be visible itself (see - Gtk.Widget.show()) in order to become the visible child of self.- New in version 3.10. 
 
Property Details¶
- 
Gtk.Stack.props.hhomogeneous¶
- Name: - hhomogeneous- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Trueif the stack allocates the same width for all children.- New in version 3.16. 
- 
Gtk.Stack.props.homogeneous¶
- Name: - homogeneous- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Homogeneous sizing 
- 
Gtk.Stack.props.interpolate_size¶
- Name: - interpolate-size- Type: - bool- Default Value: - False- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether or not the size should smoothly change when changing between differently sized children 
- 
Gtk.Stack.props.transition_duration¶
- Name: - transition-duration- Type: - int- Default Value: - 200- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The animation duration, in milliseconds 
- 
Gtk.Stack.props.transition_running¶
- Name: - transition-running- Type: - bool- Default Value: - False- Flags: - READABLE- Whether or not the transition is currently running 
- 
Gtk.Stack.props.transition_type¶
- Name: - transition-type- Type: - Gtk.StackTransitionType- Default Value: - Gtk.StackTransitionType.NONE- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The type of animation used to transition 
- 
Gtk.Stack.props.vhomogeneous¶
- Name: - vhomogeneous- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Trueif the stack allocates the same height for all children.- New in version 3.16. 
- 
Gtk.Stack.props.visible_child¶
- Name: - visible-child- Type: - Gtk.Widget- Default Value: - None- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- The widget currently visible in the stack 
