rich.spinner

class rich.spinner.Spinner(name, text='', *, style=None, speed=1.0)[source]

A spinner animation.

Parameters:
  • name (str) – Name of spinner (run python -m rich.spinner).

  • text (RenderableType, optional) – A renderable to display at the right of the spinner (str or Text typically). Defaults to “”.

  • style (StyleType, optional) – Style for spinner animation. Defaults to None.

  • speed (float, optional) – Speed factor for animation. Defaults to 1.0.

Raises:

KeyError – If name isn’t one of the supported spinner animations.

render(time)[source]

Render the spinner for a given time.

Parameters:

time (float) – Time in seconds.

Returns:

A renderable containing animation frame.

Return type:

RenderableType

update(*, text='', style=None, speed=None)[source]

Updates attributes of a spinner after it has been started.

Parameters:
  • text (RenderableType, optional) – A renderable to display at the right of the spinner (str or Text typically). Defaults to “”.

  • style (StyleType, optional) – Style for spinner animation. Defaults to None.

  • speed (float, optional) – Speed factor for animation. Defaults to None.

Return type:

None