Skip to main content

(Py)QtWaitingSpinner is a highly configurable, custom Qt widget for showing "waiting" or "loading" spinner icons in (Py)Qt(6) applications.

Project description

PyQtWaitingSpinner

Python Static Badge Static Badge

PyPI - Version PyPI - Implementation PyPI - Wheel

GitLab Issues

(Py)QtWaitingSpinner is a highly configurable, custom (Py)Qt widget for showing "waiting", or "loading", spinner icons in (Py)Qt applications.

Based on pyqtspinner, by fbjorn, which is a fork of z3ntu's port of snowwlex's QtWaitingSpinner.

The spinners below are all (Py)QtWaitingSpinner widgets, differing only in their configuration:


Original GIF by snowwlex

Original GIF by snowwlex

Original Image by fbjorn


Installation

pip install pyqtwaitingspinner


Dependencies


Configuration

The following properties can all be controlled directly through their corresponding properties:

  • Color of the widget
  • "Roundness" of the lines
  • Speed (rotations per second)
  • Number of lines to be drawn
  • Line length
  • Line width
  • Radius of the spinner's "dead space" or inner circle
  • The percentage fade of the "trail"
  • The minimum opacity of the "trail"
  • Whether to center the spinner on its parent widget
  • Whether or not to disable the parent widget whilst the spinner is spinning
  • The direction in which the spinner will spin

Usage

Spinner

The following code will create a simple spinner that

  • (1) blocks all user input to the main application for as long as the spinner is active
  • (2) automatically centers itself on its parent widget every time "start" is called
  • (3) makes use of the default shape, size and color settings.
spin_pars = SpinnerParameters(disable_parent_when_spinning=True)
spinner = WaitingSpinner(parent, spin_pars)

Configurator

The graphical Configurator allows you edit the parameters of the spinner, and view the changes live.

The Configurator can be launched with:

spinner-conf

configuration

Once the spinner's appearance is to your liking, you can either copy (and view) the initialization parameters for the construction of a SpinnerParameters object, or you can save the spinner as a YAML configuration and load it from within a WaitingSpinner class.

Show Init Args

Pressing the Show Init Args button will show the initialization arguments for the equivalent SpinnerParameters object, and will make a copy to the clipboard, including newlines and whitespace.

show-init-args

SpinnerParameters(
    roundness=100.0,
    trail_fade_percentage=67.0,
    number_of_lines=8,
    line_length=40,
    line_width=40,
    inner_radius=32,
    revolutions_per_second=1.0,
    color=QColor(0, 170, 0),
    minimum_trail_opacity=1.0,
    spin_direction=SpinDirection.COUNTERCLOCKWISE,
    center_on_parent=True,
    disable_parent_when_spinning=False,
)

Save Config

Pressing the Save button will open a dialog allowing you to select the location, and name, in which to save the configured spinner. The outputted YAML file can then be loaded like so:

spinner = WaitingSpinner(parent)
spinner.load("path/to/spinner.yaml")

Documentation

Full documentation at ReadTheDocs


Credits


Enjoy!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqtwaitingspinner-1.3.2.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

pyqtwaitingspinner-1.3.2-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file pyqtwaitingspinner-1.3.2.tar.gz.

File metadata

  • Download URL: pyqtwaitingspinner-1.3.2.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pyqtwaitingspinner-1.3.2.tar.gz
Algorithm Hash digest
SHA256 17985450521c85d670e44b15a750bbd47689499ba795a57ec4d46dd738ff942d
MD5 19f74a529ca29f41b9b11e0f899807f6
BLAKE2b-256 a1bf26482cec798e88ead3aa266c09e2b0079b448ff8508c97d78a68ce4f4207

See more details on using hashes here.

File details

Details for the file pyqtwaitingspinner-1.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqtwaitingspinner-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7300f1d3f7718910b893af70794845bd28253de6081723b514ac670f855cce24
MD5 3dae22eb02853e58e3917d067338e617
BLAKE2b-256 e02602c4c0a292ed991368bc9cbf5d861fcfaaa0623e59cf5b158031eadaef20

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page