PyQt Switch (O ) -> ( O)
Project description
pyqt-switch
PyQt Switch (O ) -> ( O)
You can choose the option to set the colorizing/moving animation.
Requirements
PyQt5 >= 5.8
Setup
python -m pip install pyqt-switch
Feature
-
Provide
toggled(bool)signal -
Set the animation with
setAnimation(f: bool). Default is False. -
Set the diameter of circle-shaped switch button with
setCircleDiameter(diameter: int). Default is 20(px).
Example
Code Sample
from PyQt5.QtWidgets import QWidget, QFormLayout, QApplication, QLabel
from pyqt_switch import PyQtSwitch
class Widget(QWidget):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
switch = PyQtSwitch()
switch.toggled.connect(self.__toggled)
switch.setAnimation(True)
# switch.setCircleDiameter(40)
self.__label = QLabel()
self.__label.setText('No')
lay = QFormLayout()
lay.addRow(self.__label, switch)
self.setLayout(lay)
def __toggled(self, f):
if f:
self.__label.setText('Yes')
else:
self.__label.setText('No')
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
example = Widget()
example.show()
app.exec_()
Result
If you set the circle diameter to 40 with switch.setCircleDiameter(40)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyqt-switch-0.0.16.tar.gz.
File metadata
- Download URL: pyqt-switch-0.0.16.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b32f9105b3f5492d31cd668d81d37c67b688607f6dab849e3b6a5fe0ade52733
|
|
| MD5 |
b253a6fd59e133a35b89de0bfd45e416
|
|
| BLAKE2b-256 |
0c985891e9b6d8f8ce9358762e548de021f922742c376209e63e82a5d91263a1
|
File details
Details for the file pyqt_switch-0.0.16-py3-none-any.whl.
File metadata
- Download URL: pyqt_switch-0.0.16-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f15d7f8e87c72b0da3759689d7466c9ebb67c2bee99829fe5f267d5d663a7fd9
|
|
| MD5 |
4facb49e4fa6ce31af4ce691dc2dd9b1
|
|
| BLAKE2b-256 |
423f9894af17ce4fbfe65338da11e05b931334bf1f6001cd70a774d8c39e28f4
|