PyQtDarkTheme
Dark theme for PySide, PyQt and Qt Designer.
This python module applies a theme to a Qt applications(PySide6, PyQt6, PyQt5 and PySide2) using a qt stylesheets system.
There's a Light Theme too. Color and style balanced from the Dark theme for easy viewing in daylight.
Dark Theme
Light Theme
Requirements
- Python 3.7+
- PySide6, PyQt6, PyQt5 or PySide2
Installation Method
From PyPi
- Last released version
pip install pyqtdarktheme
- Latest development version
pip install git+https://github.com/5yutan5/PyQtDarkTheme
From conda
- Last released version
conda install -c qt_theme pyqtdarktheme
Usage
import sys
import qdarktheme
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton
app = QApplication(sys.argv)
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)
app.setStyleSheet(qdarktheme.load_stylesheet())
main_win.show()
app.exec()
⚠ The quality of image may be low on Qt5(PyQt5, PySide2) due to the use of svg. You can add the following attribute to improve the quality of images.
app.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps)
Light theme
app.setStyleSheet(qdarktheme.load_stylesheet("light"))
Check common widgets
Input the following command in a terminal to check common widgets.
python -m qdarktheme.examples.widget_gallery
Custom Properties
This module provides several custom properties.
You can use setProperty() of the widget object to apply a modern style.
For example, if you set the QToolbar type property to sidebar, the style for the sidebar will be applied.
sidebar = QToolBar()
sidebar.setProperty("type", "sidebar")
| Widget | Property | Property value | Default | Command for demo |
|---|---|---|---|---|
| QToolBar | type | toolbar, sidebar | toolbar | python -m qdarktheme.examples.sidebar |
| QPushButton | type | outlined, contained, text | outlined | python -m qdarktheme.examples.pushbutton |
| QLineEdit | state | normal, warning, error | normal | python -m qdarktheme.examples.lineedit |
| QFrame | type | normal, h_line, v_line | normal | python -m qdarktheme.examples.line |
Support Qt Designer
This module support Qt Designer.
How to use PyQtDarktheme with Qt Designer.
- Run the following command in the terminal to launch the app that creates the template for the designer.
python -m qdarktheme.designer_supporter
- Select a theme(dark or light) and press the Create button to create a template in any folder.
- Copy the style sheet displayed in the text box.
- Start Qt designer and save the ui file in the root of the template you created.
- Paste the copied stylesheet into the top-level widget.
- Register the resource file(.qrc) in the template to the resource browser.
⚠ Support for Qt’s resource system has been removed in PyQt6. Therefore, if you want to use Qt Designer in PyQt6, you need to delete the stylesheet in the ui file and load the stylesheet using
load_stylesheet().
License
The icons used in the demo code are sourced from the Material design icons(Apache License Version 2.0).
Any file not listed the NOTICE.md file is covered by PyQtDarkTheme's MIT license.
Metadata
Release files for pyqtdarktheme 0.1.3
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 |
|---|---|---|---|---|
| PyQtDarkTheme-0.1.3.tar.gz | 39.2 kB | Without provenance | Details for PyQtDarkTheme-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| PyQtDarkTheme-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for PyQtDarkTheme-0.1.3-py3-none-any.whl |
Total release size: 130.3 kB
Release files / PyQtDarkTheme-0.1.3.tar.gz
| Download URL | PyQtDarkTheme-0.1.3.tar.gz |
|---|---|
| Size | 39.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa5a92144364daea54452eada5bdee7988f343d1e3f7d9b234d8f810e92df1e6
|
|
BLAKE2b-256 checksum How to use checksums |
d935187c366b2aa8349d6698c881134ae1fe6306320a38d2fae0ddad02771f99
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.9.6 Darwin/20.5.0
|
Release files / PyQtDarkTheme-0.1.3-py3-none-any.whl
| Download URL | PyQtDarkTheme-0.1.3-py3-none-any.whl |
|---|---|
| Size | 91.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
735659880ca775ebe6d1c8f58c9a152450f35ce6b337d5ad2459ff96478acc8d
|
|
BLAKE2b-256 checksum How to use checksums |
9fcf9edce547d300c2a1cacaf4478de878664f147eb495bcfaf4cf8edd191947
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.9.6 Darwin/20.5.0
|
Security for pyqtdarktheme 0.1.3
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.