Adw.NavigationPage

g Adw.NavigationPage Adw.NavigationPage GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Widget->Adw.NavigationPage

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (child, title)

class

new_with_tag (child, title, tag)

get_can_pop ()

get_child ()

get_tag ()

get_title ()

set_can_pop (can_pop)

set_child (child)

set_tag (tag)

set_title (title)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

do_hidden ()

do_hiding ()

do_showing ()

do_shown ()

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

can-pop

bool

r/w/en

child

Gtk.Widget

r/w/en

tag

str

r/w/en

title

str

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

hidden

Emitted when the navigation view transition has been completed and the page is fully hidden.

hiding

Emitted when the page starts hiding at the beginning of the navigation view transition.

showing

Emitted when the page shows at the beginning of the navigation view transition.

shown

Emitted when the navigation view transition has been completed and the page is fully shown.

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gtk.Widget

r

Class Details

class Adw.NavigationPage(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Adw.NavigationPageClass

A page within [class`NavigationView`] or [class`NavigationSplitView`].

Each page has a child widget, a title and optionally a tag.

The [signal`NavigationPage`:py:func:::showing<Adw.NavigationPage.signals.showing>], [signal`NavigationPage`:py:func:::shown<Adw.NavigationPage.signals.shown>], [signal`NavigationPage`:py:func:::hiding<Adw.NavigationPage.signals.hiding>] and [signal`NavigationPage`:py:func:::hidden<Adw.NavigationPage.signals.hidden>] signals can be used to track the page’s visibility within its AdwNavigationView.

Header Bar Integration

When placed inside AdwNavigationPage, [class`HeaderBar`] will display the page title instead of window title.

When used together with [class`NavigationView`], it will also display a back button that can be used to go back to the previous page. Set [property`HeaderBar`:py:data::show-back-button<Adw.NavigationPage.props.show_back_button>] to FALSE to disable that behavior if it’s unwanted.

CSS Nodes

AdwNavigationPage has a single CSS node with name navigation-view-page.

Accessibility

AdwNavigationPage uses the GTK_ACCESSIBLE_ROLE_GROUP role.

New in version 1.4.

classmethod new(child, title)
Parameters:
  • child (Gtk.Widget) – the child widget

  • title (str) – the page title

Returns:

the new created AdwNavigationPage

Return type:

Adw.NavigationPage

Creates a new AdwNavigationPage.

New in version 1.4.

classmethod new_with_tag(child, title, tag)
Parameters:
  • child (Gtk.Widget) – the child widget

  • title (str) – the page title

  • tag (str) – the page tag

Returns:

the new created AdwNavigationPage

Return type:

Adw.NavigationPage

Creates a new AdwNavigationPage with provided tag.

New in version 1.4.

get_can_pop()
Returns:

whether the page can be popped from navigation stack

Return type:

bool

Gets whether self can be popped from navigation stack.

New in version 1.4.

get_child()
Returns:

the child widget of self

Return type:

Gtk.Widget or None

Gets the child widget of self.

New in version 1.4.

get_tag()
Returns:

the page tag

Return type:

str or None

Gets the tag of self.

New in version 1.4.

get_title()
Returns:

the title of self

Return type:

str

Gets the title of self.

New in version 1.4.

set_can_pop(can_pop)
Parameters:

can_pop (bool) – whether the page can be popped from navigation stack

Sets whether self can be popped from navigation stack.

Set it to FALSE to disable shortcuts and gestures, as well as remove the back button from [class`HeaderBar`].

Manually calling [method`NavigationView`.pop] or using the navigation.pop action will still work.

See [property`HeaderBar`:py:data::show-back-button<Adw.NavigationPage.props.show_back_button>] for removing only the back button, but not shortcuts.

New in version 1.4.

set_child(child)
Parameters:

child (Gtk.Widget or None) – the child widget

Sets the child widget of self.

New in version 1.4.

set_tag(tag)
Parameters:

tag (str or None) – the page tag

Sets the tag for self.

The tag can be used to retrieve the page with [method`NavigationView`.find_page], as well as with [method`NavigationView`.push_by_tag], [method`NavigationView`.pop_to_tag] or [method`NavigationView`.replace_with_tags].

Tags must be unique within each [class`NavigationView`].

The tag also must be set to use the navigation.push action.

New in version 1.4.

set_title(title)
Parameters:

title (str) – the title

Sets the title of self.

It’s displayed in [class`HeaderBar`] instead of the window title, and used as the tooltip on the next page’s back button, as well as by screen reader.

New in version 1.4.

do_hidden() virtual

Called when the navigation view transition has been completed and the page is fully hidden.

New in version 1.4.

do_hiding() virtual

Called when the page starts hiding at the beginning of the navigation view transition.

New in version 1.4.

do_showing() virtual

Called when the page shows at the beginning of the navigation view transition.

New in version 1.4.

do_shown() virtual

Called when the navigation view transition has been completed and the page is fully shown.

New in version 1.4.

Signal Details

Adw.NavigationPage.signals.hidden(navigation_page)
Signal Name:

hidden

Flags:

RUN_LAST

Parameters:

navigation_page (Adw.NavigationPage) – The object which received the signal

Emitted when the navigation view transition has been completed and the page is fully hidden.

It will always be preceded by [signal`NavigationPage`:py:func:::hiding<Adw.NavigationPage.signals.hiding>] or [signal`NavigationPage`:py:func:::showing<Adw.NavigationPage.signals.showing>].

New in version 1.4.

Adw.NavigationPage.signals.hiding(navigation_page)
Signal Name:

hiding

Flags:

RUN_LAST

Parameters:

navigation_page (Adw.NavigationPage) – The object which received the signal

Emitted when the page starts hiding at the beginning of the navigation view transition.

It will always be followed by [signal`NavigationPage`:py:func:::hidden<Adw.NavigationPage.signals.hidden>] or [signal`NavigationPage`:py:func:::shown<Adw.NavigationPage.signals.shown>].

New in version 1.4.

Adw.NavigationPage.signals.showing(navigation_page)
Signal Name:

showing

Flags:

RUN_LAST

Parameters:

navigation_page (Adw.NavigationPage) – The object which received the signal

Emitted when the page shows at the beginning of the navigation view transition.

It will always be followed by [signal`NavigationPage`:py:func:::shown<Adw.NavigationPage.signals.shown>] or [signal`NavigationPage`:py:func:::hidden<Adw.NavigationPage.signals.hidden>].

New in version 1.4.

Adw.NavigationPage.signals.shown(navigation_page)
Signal Name:

shown

Flags:

RUN_LAST

Parameters:

navigation_page (Adw.NavigationPage) – The object which received the signal

Emitted when the navigation view transition has been completed and the page is fully shown.

It will always be preceded by [signal`NavigationPage`:py:func:::showing<Adw.NavigationPage.signals.showing>] or [signal`NavigationPage`:py:func:::hiding<Adw.NavigationPage.signals.hiding>].

New in version 1.4.

Property Details

Adw.NavigationPage.props.can_pop
Name:

can-pop

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the page can be popped from navigation stack.

Set it to FALSE to disable shortcuts and gestures, as well as remove the back button from [class`HeaderBar`].

Manually calling [method`NavigationView`.pop] or using the navigation.pop action will still work.

See [property`HeaderBar`:py:data::show-back-button<Adw.NavigationPage.props.show_back_button>] for removing only the back button, but not shortcuts.

New in version 1.4.

Adw.NavigationPage.props.child
Name:

child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The child widget.

New in version 1.4.

Adw.NavigationPage.props.tag
Name:

tag

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The page tag.

The tag can be used to retrieve the page with [method`NavigationView`.find_page], as well as with [method`NavigationView`.push_by_tag], [method`NavigationView`.pop_to_tag] or [method`NavigationView`.replace_with_tags].

Tags must be unique within each [class`NavigationView`].

The tag also must be set to use the navigation.push action.

New in version 1.4.

Adw.NavigationPage.props.title
Name:

title

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The page title.

It’s displayed in [class`HeaderBar`] instead of the window title, and used as the tooltip on the next page’s back button, as well as by screen reader.

New in version 1.4.