ToastOverlay#

class ToastOverlay(**properties: Any)#

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget

A widget showing toasts above its content.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/toast-overlay.png

Much like Overlay, AdwToastOverlay is a container with a single main child, on top of which it can display a Toast, overlaid. Toasts can be shown with add_toast.

See Toast for details.

CSS nodes#

toastoverlay
├── [child]
├── toast
┊   ├── widget
┊   │   ├── [label.heading]
    │   ╰── [custom title]
    ├── [button]
    ╰── button.circular.flat

AdwToastOverlay's CSS node is called toastoverlay. It contains the child, as well as zero or more toast subnodes.

Each of the toast nodes contains a widget subnode, optionally a button subnode, and another button subnode with .circular and .flat style classes.

The widget subnode contains a label subnode with the .heading style class, or a custom widget provided by the application.

Accessibility#

AdwToastOverlay uses the GROUP role.

Constructors#

class ToastOverlay
classmethod new() Widget#

Creates a new AdwToastOverlay.

Methods#

class ToastOverlay
add_toast(toast: Toast) None#

Displays toast.

Only one toast can be shown at a time; if a toast is already being displayed, either toast or the original toast will be placed in a queue, depending on the priority of toast. See priority.

If called on a toast that’s already displayed, its timeout will be reset.

If called on a toast currently in the queue, the toast will be bumped forward to be shown as soon as possible.

Parameters:

toast – a toast

get_child() Widget | None#

Gets the child widget of self.

set_child(child: Widget | None = None) None#

Sets the child widget of self.

Parameters:

child – the child widget

Properties#

class ToastOverlay
props.child: Widget#

The type of the None singleton.