An easy-to-use and modern toggle switch for Qt Python binding PyQt
Project description
This is the beta branch, there might be some known or unknown bugs that I would be happy if you report them in issues after your experience.
Also there is no guarantee that new features will be available on the next stable release.
The assets of beta version is available in latest Pre Release.
QSwitchControl
Custom toggle-switch widget implemented in PyQt5 for PyQt5 applications!
An easy-to-use and modern toggle switch for Qt Python binding PyQt
QSwitchControl is a custom toggle-switch widget inherited from 'QCheckBox' class, and acts as a checkbox alternative widget in your PyQt5 application.
How to use?
Installation
The package is available on PyPi so as always use pip for installation.
Usage in your Python application
First of all, as expected, you need to import the package. Import 'SwitchControl' class from the package:
from QSwitchControl import SwitchControl
Now the class is ready to use! SwitchControl is an alternative widget for QCheckBox from Qt framework, same methods, same usage and that's how it works. There are things you can define for your SwitchControl, like the circle color, background color, active color, animation easing curve, animation duration and some other things, but you can use default values. The package contains a 'main' script so you can test the widget easily:
python -m QSwitchControl
In '__main__' script we used the default values for our widget:
switch_control = SwitchControl()
You can define the values yourself. Bellow is an example:
switch_control = SwitchControl(bg_color="#777777", circle_color="#DDD", active_color="#aa00ff", animation_curve=QtCore.QEasingCurve.InOutCubic, animation_duration=300, checked=True, change_cursor=False)
Qt Designer integration
Qt Designer is a very extensible tool, even can support your custom widgets! It means you can interact with your custom widget just as you do with Qt widgets, like QPushButton, QCheckBox, you can drag and drop them on your form, change their sizes, set properties and so on. Qt Designer can load plugins, and you can load your custom widgets through plugins, then your custom widget is available in Qt Designer Widget Box. In C++, using Qt Creator IDE you can create your custom widgets and compile them to .dll file, then you put the dll file (your plugin) into Qt Designer's relative path for plugins, and that's it you can use your widget in Designer. But, here in python the story is a little different. PyQt supports this plugin developement and integrate Python based Qt custom widgets in Qt Designer. Learn more about integrating PyQt custom widgets in Qt Designer There is the Qt Designer plugin for QSwitchControl in package, QSwitchControlplugin.py. You can load it to your Qt Designer.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file QSwitchControl-2.0.3.Beta.tar.gz
.
File metadata
- Download URL: QSwitchControl-2.0.3.Beta.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 102d9871c2ba84a595fa1dec0897d980ee1a1280327828e8a5fc737591101e10 |
|
MD5 | cf2c092f7f6ac50f4dd49c434bc96cc8 |
|
BLAKE2b-256 | a220fe4b2d6d1333a8b54663b187a810ba1328a6da7d3b6ccfe460442eb1e1fb |
File details
Details for the file QSwitchControl-2.0.3b0-py3-none-any.whl
.
File metadata
- Download URL: QSwitchControl-2.0.3b0-py3-none-any.whl
- Upload date:
- Size: 14.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2db0c55c5f0d7bb779f77d0787a92cc790807b816ddbe518d528206296035a95 |
|
MD5 | b3cc028406e25c94f0bb7a27e4f70fa5 |
|
BLAKE2b-256 | a0aa77ad6a7601565a37a03aa1dfdce08da0e59e2ba223544b1da173ad923402 |