Skip to content

A waiting spinner ported to Python 3 and PySide6

License

Notifications You must be signed in to change notification settings

Mithro86/QtWaitingSpinner

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

QtWaitingSpinner

QtWaitingSpinner is a highly configurable, custom Qt widget for showing "waiting" or "loading" spinner icons in Qt applications, e.g. the spinners below are all QtWaitingSpinner widgets differing only in their configuration:

waiting spinner

Configuration

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

  • 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"

Usage

Despite being highly configurable, QtWaitingSpinner is extremely easy to use and, to make things even easier, the "QtWaitingSpinnerTest" application can assist you in determining the exact shape, size and color you'd like your spinner to have.

For example, the embedded spinner in the QtWaitingSpinnerTest screenshot below can be created as follows:

from waitingspinnerwidget import QtWaitingSpinner

spinner = QtWaitingSpinner(self)

spinner.setRoundness(70.0)
spinner.setMinimumTrailOpacity(15.0)
spinner.setTrailFadePercentage(70.0)
spinner.setNumberOfLines(12)
spinner.setLineLength(10)
spinner.setLineWidth(5)
spinner.setInnerRadius(10)
spinner.setRevolutionsPerSecond(1)
spinner.setColor(QColor(81, 4, 71))

spinner.start()

A demo is included with the demo.py file.

demo dialog

As an alternative example, the code below will create a 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 and (3) makes use of the default shape, size and color settings.

spinner = QtWaitingSpinner(self, True, True, Qt.ApplicationModal)
spinner.start() # starts spinning

Please use use this link for feedback, requests or issues.

Enjoy!

Thanks:

to @snowwlex for the base of my port (and this README)!

QtWaitingSpinner was inspired by the spin.js project.

About

A waiting spinner ported to Python 3 and PySide6

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%