Dark theme for PySide, PyQt and Qt Designer.
Project description
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
pip install 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()
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.
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 PyQtDarkTheme-0.1.2.tar.gz
.
File metadata
- Download URL: PyQtDarkTheme-0.1.2.tar.gz
- Upload date:
- Size: 38.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.6 Darwin/20.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a797a2c76e0b1deaeb6cd490be8c99914a2096b7d82a0bf5dc0f924ab2f8f3d |
|
MD5 | bc6b631e8248eec042e9a7966fb9a9c5 |
|
BLAKE2b-256 | 8e30df53f77b650ca330732d8be92ff7b76d6f043b8875bb0914f5db5f76de22 |
File details
Details for the file PyQtDarkTheme-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: PyQtDarkTheme-0.1.2-py3-none-any.whl
- Upload date:
- Size: 90.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.9.6 Darwin/20.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee869cf41fe1a8d4d2862b961ae1ed0b472e3d88acde9f54d130cfc5e0330575 |
|
MD5 | a7f796c7c0cdffb810efcbb9f7e0e163 |
|
BLAKE2b-256 | faed4ca09b1d1eddbc71acd194766b939a6093e7ed6a4c0eb4c2f7afb3ebc6f2 |