Skip to main content

Dark theme for PySide, PyQt and Qt Designer.

Project description

PyQtDarkTheme

PyPI Latest Release Conda Latest Release Python Versions License Total alerts Language grade: Python Code style: black

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

widget_gallery_dark_theme

Light Theme

widget_gallery_light_them

Requirements

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.

  1. Run the following command in the terminal to launch the app that creates the template for the designer.
    python -m qdarktheme.designer_supporter
    
  2. Select a theme(dark or light) and press the Create button to create a template in any folder.
  3. Copy the style sheet displayed in the text box.
  4. Start Qt designer and save the ui file in the root of the template you created.
  5. Paste the copied stylesheet into the top-level widget.
  6. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyQtDarkTheme-0.1.4.tar.gz (39.4 kB view details)

Uploaded Source

Built Distribution

PyQtDarkTheme-0.1.4-py3-none-any.whl (91.1 kB view details)

Uploaded Python 3

File details

Details for the file PyQtDarkTheme-0.1.4.tar.gz.

File metadata

  • Download URL: PyQtDarkTheme-0.1.4.tar.gz
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.9.6 Darwin/20.5.0

File hashes

Hashes for PyQtDarkTheme-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d345d816b65001659af607550b708ccbc9d62c8784e9cc53952daaf3ff611464
MD5 c82771b7a02915d529f1975d285a7f3b
BLAKE2b-256 568d5a75a0f60e2d5dc90dd7ecf2e87c69862745a60a62fae8f5c8091fdca434

See more details on using hashes here.

File details

Details for the file PyQtDarkTheme-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: PyQtDarkTheme-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 91.1 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

Hashes for PyQtDarkTheme-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ce8bb85351888f53f5c1f930c786b07a1629b2d2ca2c4dbad434e4a2186b2bef
MD5 6abe96e9b81d8a5aed0989e4f43a1d9c
BLAKE2b-256 e6cbf2e13932a96c96ebebb8ab8530bb1055c0ad64cfa96fe59d46bace459991

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page