PyQt color picker dialog
Project description
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')
-
color
argument's type can beQColor
orstr
. -
orientation
argument 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
- signal. After color being changed, this will be emitted.
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):
te = QTextEdit()
colorPicker = ColorPickerWidget(orientation='vertical')
lay = QHBoxLayout()
lay.addWidget(te)
lay.addWidget(colorPicker)
mainWidget = QWidget()
mainWidget.setLayout(lay)
self.setCentralWidget(mainWidget)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = Window()
ex.show()
sys.exit(app.exec_())
Result
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
Hashes for pyqt_color_picker-0.0.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073ec96b91e5bab76a2419d10889842b20548af618e8b80425ce1384bf2c7082 |
|
MD5 | e088784a23b5d26b1d70dd98b6828308 |
|
BLAKE2b-256 | 38cb9e6ebb78736811db070ebbd3a9bc5984ca2634f07e5096ea2306e939c461 |