Gtk.Assistant¶
class — extends Window, Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager
:::warning Deprecated since 4.10 This API is deprecated. :::
GtkAssistant is used to represent a complex as a series of steps.
<picture> <source srcset="assistant-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkAssistant" src="assistant.png"> </picture>
Each step consists of one or more pages. GtkAssistant guides the user
through the pages, and controls the page flow to collect the data needed
for the operation.
GtkAssistant handles which buttons to show and to make sensitive based
on page sequence knowledge and the AssistantPageType of each
page in addition to state information like the completed and committed
page statuses.
If you have a case that doesn’t quite fit in GtkAssistants way of
handling buttons, you can use the AssistantPageType.CUSTOM page
type and handle buttons yourself.
GtkAssistant maintains a GtkAssistantPage object for each added
child, which holds additional per-child properties. You
obtain the GtkAssistantPage for a child with Assistant.get_page.
GtkAssistant as GtkBuildable¶
The GtkAssistant implementation of the GtkBuildable interface
exposes the action_area as internal children with the name
“action_area”.
To add pages to an assistant in GtkBuilder, simply add it as a
child to the GtkAssistant object. If you need to set per-object
properties, create a GtkAssistantPage object explicitly, and
set the child widget as a property on it.
CSS nodes¶
GtkAssistant has a single CSS node with the name window and style
class .assistant.
Constructors¶
new¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Creates a new GtkAssistant.
Methods¶
add_action_widget¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Adds a widget to the action area of a GtkAssistant.
Parameters:
child— aGtkWidget
append_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Appends a page to the assistant.
Parameters:
page— aGtkWidget
commit¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Erases the visited page history.
GTK will then hide the back button on the current page, and removes the cancel button from subsequent pages.
Use this when the information provided up to the current page is hereafter deemed permanent and cannot be modified or undone. For example, showing a progress page to track a long-running, unreversible operation after the user has clicked apply on a confirmation page.
get_current_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns the page number of the current page.
get_n_pages¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns the number of pages in the assistant
get_nth_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns the child widget contained in page number page_num.
Parameters:
page_num— the index of a page in theassistant, or -1 to get the last page
get_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns the GtkAssistantPage object for child.
Parameters:
child— a child ofassistant
get_page_complete¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets whether page is complete.
Parameters:
page— a page ofassistant
get_page_title¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the title for page.
Parameters:
page— a page ofassistant
get_page_type¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets the page type of page.
Parameters:
page— a page ofassistant
get_pages¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets a list model of the assistant pages.
insert_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Inserts a page in the assistant at a given position.
Parameters:
page— aGtkWidgetposition— the index (starting at 0) at which to insert the page, or -1 to append the page to theassistant
next_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Navigate to the next page.
It is a programming error to call this function when there is no next page.
This function is for use when creating pages of the
AssistantPageType.CUSTOM type.
prepend_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Prepends a page to the assistant.
Parameters:
page— aGtkWidget
previous_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Navigate to the previous visited page.
It is a programming error to call this function when no previous page is available.
This function is for use when creating pages of the
AssistantPageType.CUSTOM type.
remove_action_widget¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Removes a widget from the action area of a GtkAssistant.
Parameters:
child— aGtkWidget
remove_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Removes the page_num’s page from assistant.
Parameters:
page_num— the index of a page in theassistant, or -1 to remove the last page
set_current_page¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Switches the page to page_num.
Note that this will only be necessary in custom buttons,
as the assistant flow can be set with
Assistant.set_forward_page_func.
Parameters:
page_num— index of the page to switch to, starting from 0. If negative, the last page will be used. If greater than the number of pages in theassistant, nothing will be done.
set_forward_page_func¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the page forwarding function to be page_func.
This function will be used to determine what will be
the next page when the user presses the forward button.
Setting page_func to None will make the assistant to
use the default forward function, which just goes to the
next visible page.
Parameters:
page_func— theGtkAssistantPageFunc, orNoneto use the default one
set_page_complete¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets whether page contents are complete.
This will make assistant update the buttons state
to be able to continue the task.
Parameters:
page— a page ofassistantcomplete— the completeness status of the page
set_page_title¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets a title for page.
The title is displayed in the header area of the assistant
when page is the current page.
Parameters:
page— a page ofassistanttitle— the new title forpage
set_page_type¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the page type for page.
The page type determines the page behavior in the assistant.
Parameters:
page— a page ofassistanttype— the new type forpage
update_buttons_state¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Forces assistant to recompute the buttons state.
GTK automatically takes care of this in most situations, e.g. when the user goes to a different page, or when the visibility or completeness of a page changes.
One situation where it can be necessary to call this function is when changing a value on the current page affects the future page flow of the assistant.
Properties¶
pages¶
GListModel containing the pages.
use_header_bar¶
:::warning Deprecated since 4.10 This API is deprecated. :::
True if the assistant uses a GtkHeaderBar for action buttons
instead of the action-area.
For technical reasons, this property is declared as an integer
property, but you should only set it to True or False.
Signals¶
apply¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Emitted when the apply button is clicked.
The default behavior of the GtkAssistant is to switch to the page
after the current page, unless the current page is the last one.
A handler for the ::apply signal should carry out the actions for
which the wizard has collected data. If the action takes a long time
to complete, you might consider putting a page of type
AssistantPageType.PROGRESS after the confirmation page and handle
this operation within the Assistant.prepare signal of
the progress page.
cancel¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Emitted when then the cancel button is clicked.
close¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Emitted either when the close button of a summary page is clicked,
or when the apply button in the last page in the flow (of type
AssistantPageType.CONFIRM) is clicked.
escape¶
:::warning Deprecated since 4.10 This API is deprecated. :::
The action signal for the Escape binding.
prepare¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Emitted when a new page is set as the assistant's current page, before making the new page visible.
A handler for this signal can do any preparations which are
necessary before showing page.