Skip to content

Gtk.Spinner

class — extends Widget, Accessible, Buildable, ConstraintTarget

Displays an icon-size spinning animation.

It is often used as an alternative to a ProgressBar for displaying indefinite activity, instead of actual progress.

<picture> <source srcset="spinner-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkSpinner" src="spinner.png"> </picture>

To start the animation, use Spinner.start, to stop it use Spinner.stop.

CSS nodes

GtkSpinner has a single CSS node with the name spinner. When the animation is active, the :checked pseudoclass is added to this node.

Accessibility

GtkSpinner uses the AccessibleRole.progress_bar role.

Constructors

new

@classmethod
def new(cls) -> Widget

Returns a new spinner widget. Not yet started.

Methods

get_spinning

def get_spinning(self) -> bool

Returns whether the spinner is spinning.

set_spinning

def set_spinning(self, spinning: bool) -> None

Sets the activity of the spinner.

Parameters:

  • spinning — whether the spinner should be spinning

start

def start(self) -> None

Starts the animation of the spinner.

stop

def stop(self) -> None

Stops the animation of the spinner.

Properties

spinning

spinning: bool  # read/write

Whether the spinner is spinning