Skip to content

Loading Spinner

Widgets for displaying loading states and progress indicators.

Preview

FXLoadingSpinner

Classes

FXLoadingSpinner

Bases: FXThemeAware, QWidget

A themeable animated loading indicator.

This widget provides a modern spinning/pulsing loading indicator with customizable colors and animation styles.

Parameters:

Name Type Description Default

parent

Optional[QWidget]

Parent widget.

None

size

int

Size of the spinner in pixels.

32

line_width

int

Width of the spinner lines.

3

color

Optional[str]

Spinner color. If None, uses theme accent.

None

style

str

Animation style ('spinner', 'dots', 'pulse').

'spinner'

Examples:

>>> spinner = FXLoadingSpinner(size=32)
>>> spinner.start()
>>> # ... do some work ...
>>> spinner.stop()

Methods:

Name Description
angle

Set the rotation angle.

is_spinning

Return whether the spinner is currently animating.

paintEvent

Paint the loading spinner.

set_color

Set the spinner color.

set_style

Set the animation style.

start

Start the loading animation.

stop

Stop the loading animation.

angle

angle(value: int) -> None

Set the rotation angle.

is_spinning

is_spinning() -> bool

Return whether the spinner is currently animating.

paintEvent

paintEvent(event) -> None

Paint the loading spinner.

set_color

set_color(color: str) -> None

Set the spinner color.

Parameters:

Name Type Description Default

color

str

Color string (hex, rgb, etc.).

required

set_style

set_style(style: str) -> None

Set the animation style.

Parameters:

Name Type Description Default

style

str

Animation style ('spinner', 'dots', 'pulse').

required

start

start() -> None

Start the loading animation.

stop

stop() -> None

Stop the loading animation.

FXLoadingOverlay

Bases: FXThemeAware, QWidget

A loading overlay that blocks the parent widget.

This widget creates a semi-transparent overlay with a loading spinner, useful for indicating that a long operation is in progress.

Parameters:

Name Type Description Default

parent

Optional[QWidget]

Parent widget to overlay.

None

message

Optional[str]

Optional message to display below the spinner.

None

Examples:

>>> overlay = FXLoadingOverlay(my_widget, "Loading assets...")
>>> overlay.show()
>>> # ... do some work ...
>>> overlay.hide()

Methods:

Name Description
hide

Hide the overlay and stop the spinner.

paintEvent

Paint the semi-transparent background.

resizeEvent

Handle parent resize.

show

Show the overlay and start the spinner.

hide

hide() -> None

Hide the overlay and stop the spinner.

paintEvent

paintEvent(event) -> None

Paint the semi-transparent background.

resizeEvent

resizeEvent(event) -> None

Handle parent resize.

show

show() -> None

Show the overlay and start the spinner.