Adw.Banner¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1), Gtk.Actionable (5)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
This signal is emitted after the action button has been clicked. |
Fields¶
- Inherited:
Class Details¶
- class Adw.Banner(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A bar with contextual information.
<picture> <source srcset=”banner-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”banner.png” alt=”banner”> </picture>
Banners are hidden by default, use [property`Banner`:py:data::revealed<Adw.Banner.props.revealed>] to show them.
Banners have a title, set with [property`Banner`:py:data::title<Adw.Banner.props.title>]. Titles can be marked up with Pango markup, use [property`Banner`:py:data::use-markup<Adw.Banner.props.use_markup>] to enable it.
The title will be shown centered or left-aligned depending on available space.
Banners can optionally have a button with text on it, set through [property`Banner`:py:data::button-label<Adw.Banner.props.button_label>]. The button can be used with a
GAction
, or with the [signal`Banner`:py:func:::button-clicked<Adw.Banner.signals.button_clicked>] signal. The button can have different styles, a gray style and a suggested style.<picture> <source srcset=”banner-suggested-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”banner-suggested.png” alt=”banner with suggested button style”> </picture>
- CSS nodes
AdwBanner
has a main CSS node with the namebanner
.New in version 1.3.
- classmethod new(title)¶
- Parameters:
title (
str
) – the banner title- Returns:
the newly created
AdwBanner
- Return type:
Creates a new
AdwBanner
.New in version 1.3.
- get_button_label()¶
-
Gets the button label for self.
New in version 1.3.
- get_button_style()¶
- Returns:
the current button style
- Return type:
Gets the style class in use for the banner button.
New in version 1.7.
- get_revealed()¶
- Returns:
Whether a banner is revealed
- Return type:
Gets if a banner is revealed
New in version 1.3.
- get_title()¶
- Returns:
the title for self
- Return type:
Gets the title for self.
New in version 1.3.
- get_use_markup()¶
- Returns:
whether to use markup
- Return type:
Gets whether to use Pango markup for the banner title.
New in version 1.3.
- set_button_label(label)¶
-
Sets the button label for self.
If set to
""
orNULL
, the button won’t be shown.The button can be used with a
GAction
, or with the [signal`Banner`:py:func:::button-clicked<Adw.Banner.signals.button_clicked>] signal.New in version 1.3.
- set_button_style(style)¶
- Parameters:
style (
Adw.BannerButtonStyle
) – a button style
Sets the style class to use for the banner button.
When set to
ADW_BANNER_BUTTON_DEFAULT
, the button stays grey. When set toADW_BANNER_BUTTON_SUGGESTED
, the button follows the .suggested-action style<picture> <source srcset=”banner-suggested-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”banner-suggested.png” alt=”banner with suggested button style”> </picture>
New in version 1.7.
- set_revealed(revealed)¶
- Parameters:
revealed (
bool
) – whether a banner should be revealed
Sets whether a banner should be revealed
New in version 1.3.
Signal Details¶
- Adw.Banner.signals.button_clicked(banner)¶
- Signal Name:
button-clicked
- Flags:
- Parameters:
banner (
Adw.Banner
) – The object which received the signal
This signal is emitted after the action button has been clicked.
It can be used as an alternative to setting an action.
New in version 1.3.
Property Details¶
- Adw.Banner.props.button_label¶
- Name:
button-label
- Type:
- Default Value:
''
- Flags:
The label to show on the button.
If set to
""
orNULL
, the button won’t be shown.The button can be used with a
GAction
, or with the [signal`Banner`:py:func:::button-clicked<Adw.Banner.signals.button_clicked>] signal.New in version 1.3.
- Adw.Banner.props.button_style¶
- Name:
button-style
- Type:
- Default Value:
- Flags:
The style class to use for the banner button.
When set to
ADW_BANNER_BUTTON_DEFAULT
, the button stays grey. When set toADW_BANNER_BUTTON_SUGGESTED
, the button follows the .suggested-action style<picture> <source srcset=”banner-suggested-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”banner-suggested.png” alt=”banner with suggested button style”> </picture>
New in version 1.7.
- Adw.Banner.props.revealed¶
- Name:
revealed
- Type:
- Default Value:
- Flags:
Whether the banner is currently revealed.
New in version 1.3.
- Adw.Banner.props.title¶
- Name:
title
- Type:
- Default Value:
''
- Flags:
The title for this banner.
See also: [property`Banner`:py:data::use-markup<Adw.Banner.props.use_markup>].
New in version 1.3.