Skip to content

Spinner

A spinning arc. Its angle comes from the app clock, so keep a subscription such as pz.every(1 / 30, ...) active while it is shown or it will not move.

ui.spinner · Category: Feedback · Full reference →

SpinnerSpinner
  • For short waits with an unknown duration: connecting, searching, loading a file.
  • For long work with known progress use Progress.
import pyzed as pz
from pyzed import ui
class Loader(pz.App):
def __init__(self):
self.loading = True
def subscription(self):
return pz.every(1 / 30, lambda: None) if self.loading else None
def view(self):
return ui.spinner() if self.loading else ui.label("Done")
Spinner: size=12Spinner: size=12
size=12
Code
ui.spinner(size=12)
Spinner: size=16Spinner: size=16
size=16
Code
ui.spinner()
Spinner: size=24Spinner: size=24
size=24
Code
ui.spinner(size=24)
Spinner: size=36Spinner: size=36
size=36
Code
ui.spinner(size=36)
Spinner: tint="success"Spinner: tint="success"
tint="success"
Code
ui.spinner(size=24, tint="success")
Spinner: tint="warning"Spinner: tint="warning"
tint="warning"
Code
ui.spinner(size=24, tint="warning")
Spinner: tint="text_muted"Spinner: tint="text_muted"
tint="text_muted"
Code
ui.spinner(size=24, tint="text_muted")
Spinner: InlineSpinner: Inline
Inline
Code
pz.row([ui.spinner(size=14), ui.muted("Indexing project…")], spacing=8, align="center")
Spinner: In a buttonSpinner: In a button
In a button
Code
ui.button(pz.row([ui.spinner(size=12, tint="text"), pz.text("Saving")], spacing=6, align="center"))

Spinner has no events of its own: it shows what you give it. Like every widget it also has the 18 common events (click, double_click, right_click, mouse_enter, drag, key_down, resize…), attached with .on(...): see Events and Events of every component.

spinner(*, size=16, tint='accent', speed=1.0, theme=None)

A spinning arc for loading states. Its angle comes from the clock, so keep a pz.every(1/30, ...) subscription active while it is shown.

Property Default Description
size 16 Size.
tint "accent" Semantic color: "accent", "error", "warning", "success", "info" or a token.
speed 1.0 Turns per second.
theme None Theme to use instead of the current one (pyzed.theme.current()).

Full reference →