pyqt-color-picker
PyQt color picker dialog which contains color picker widget.
You can either use dialog or widget.
Requirements
PyQt5 >= 5.8
Setup
python -m pip install pyqt-color-picker
Class, Method Overview
ColorPickerDialog
-
ColorPickerDialog(color=QColor(255, 255, 255), orientation='horizontal')-
colorargument's type can beQColororstr. -
orientationargument decides the overall layout direction of the dialog. There are two values.'horizontal','vertical'. See layout preview below.
-
-
getColor() -> QColor- get the color.
If you only want to use this as a part of window(not as whole dialog), use ColorPickerWidget(color=QColor(255, 255, 255), orientation='horizontal'). See the example below.
ColorPickerWidget
-
colorChanged(color: QColor)- signal. After color being changed, this will be emitted. -
getCurrentColor() -> QColor- get the current color.
Layout type
Horizontal
Vertical
Usage
Dialog
Code Sample
dialog = ColorPickerDialog()
reply = dialog.exec()
if reply == QDialog.Accepted:
color = dialog.getColor() # return type is QColor
//..
Result
Using as a part of window
Code Sample
from PyQt5.QtWidgets import QMainWindow, QApplication, QHBoxLayout, QWidget, QTextEdit
from pyqt_color_picker import ColorPickerWidget
class Window(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
self.__te = QTextEdit()
self.__colorPicker = ColorPickerWidget(orientation='vertical')
self.__colorPicker.colorChanged.connect(self.colorChanged) # when color has changed, call the colorChanged function
lay = QHBoxLayout()
lay.addWidget(self.__te)
lay.addWidget(self.__colorPicker)
mainWidget = QWidget()
mainWidget.setLayout(lay)
self.setCentralWidget(mainWidget)
def colorChanged(self, color):
self.__te.setStyleSheet(f'QTextEdit {{ color: {color.name()} }}')
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = Window()
ex.show()
sys.exit(app.exec_())
Result
Metadata
Release files for pyqt-color-picker 0.0.20
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyqt-color-picker-0.0.20.tar.gz | 8.4 kB | Without provenance | Details for pyqt-color-picker-0.0.20.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyqt_color_picker-0.0.20-py3-none-any.whl | Python 3 | none | any | Details for pyqt_color_picker-0.0.20-py3-none-any.whl |
Total release size: 19.4 kB
Release files / pyqt-color-picker-0.0.20.tar.gz
| Download URL | pyqt-color-picker-0.0.20.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93e5c332c58fb7f7d0bed4d0e5a14b7ea83481ee2f8963a5e9a0cba48c3e537e
|
|
BLAKE2b-256 checksum How to use checksums |
e85adc780c7a7e5fbebb5a66d3883ccfa09f4877d17fde5865033d3e35205522
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.4
|
Release files / pyqt_color_picker-0.0.20-py3-none-any.whl
| Download URL | pyqt_color_picker-0.0.20-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c9e4dd96d120e380313d768124b5c56eae718607d8531461ca9a97c26b3eabc
|
|
BLAKE2b-256 checksum How to use checksums |
9b7713832956e215783497f44e13ed68f52d70b738c39c91f35b6925351546b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.4
|
Security for pyqt-color-picker 0.0.20
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.