Skip to main content

Python bindings for Qlementine, a modern QStyle for desktop Qt6 applications

Project description

PyQt6/PySide6-Qlementine

PyQt6/PySide6 Bindings for (the amazing) Qlementine

Modern QStyle for desktop Qt6 applications... ready for Python!

Installation

pip install PyQt6-Qlementine
# or 
pip install PySide6-Qlementine

Usage

# or PySide6 & PySide6Qlementine
from PyQt6.QtWidgets import QApplication
from PyQt6.QtCore import QJsonDocument
from PyQt6Qlementine import QlementineStyle, Theme

app = QApplication([])

# Apply Qlementine as the application style
# (this alone will apply the default Qlementine theme, which is lovely)
style = QlementineStyle(app)
app.setStyle(style)

# Define a custom theme, for all keys, see:
# https://oclero.github.io/qlementine/theme/#full-example
theme_dict = {
    "meta": {"name": "Custom", "author": "Your Name", "version": "1.0"},
    "primaryColor": "#ff00ff",
    "backgroundColorMain1": "#1a1a2e",
    "backgroundColorMain2": "#1a1a2e",
}

theme = Theme.fromJsonDoc(QJsonDocument.fromVariant(theme_dict))
style.setTheme(theme)

See C++ documentation for more information.

See also examples in this repo.

The autogenerated type stubs are also useful for understanding the API.

Why QStyle over QSS?

If you're coming from the Python Qt ecosystem, you're likely used to theming via Qt Style Sheets (QSS) — every major Python theming library (QDarkStyleSheet, qt-material, BreezeStyleSheets, etc.) relies on them.

QSS is easy to author, but it comes with serious trade-offs: it breaks setPalette() and setFont(), ignores system dark/light mode changes, forces you to restyle all sub-controls when you customize one, and adds measurable startup and reparenting cost from CSS parsing.

A proper parametrized QStyle implementation (like Qlementine) avoids all of this — colors, spacing, animations, border-radii, and pixel metrics are computed natively in C++ with full QPainter access, zero parsing overhead, and complete respect for QPalette. The reason Python libraries haven't taken this approach is that subclassing QProxyStyle in Python incurs a C++/Python boundary crossing on every paint call, making it unperformant for anything beyond icon overrides.

Qlementine sidesteps that entirely: the style is implemented in C++ and simply exposed to Python (through these bindings), giving you the correctness and performance of a native QStyle implementation with the ease of use of a Python library (and parametrized geometry, colors, animations, and fonts through Qlementine's Theme API).

License

The code in this repository is licensed under the MIT License.

The packaged/distributed bindings are:

See the LICENSE file in each package for more details.

Developers & Contributing

Contributions are welcome! See CONTRIBUTING.md for dev tips.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-win_amd64.whl (2.3 MB view details)

Uploaded CPython 3.10+Windows x86-64

pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-manylinux_2_28_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64

pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-macosx_11_0_arm64.whl (2.4 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 29a38b9831d5b7baa1f6c98f0707419527f2f10517ca63a768fbe03a4ffd3503
MD5 67b1b15b8c791dc4dad9683879e42361
BLAKE2b-256 79a9c9063c0dfc0f4aa8a6da2f27eb47e3002800eb18937b1da20f4272f42b0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-win_amd64.whl:

Publisher: publish-pyqt6.yml on pyapp-kit/PyQlementine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c281511f18afbcf3a24d1edcbfb6812cc13f5e69d216ae32500c2abadf07b3b8
MD5 8532fb5aa674222269f9228abf25aa81
BLAKE2b-256 1e7ee1742d2b107fcfc43c89d3241a3f5323d633654f4b6daf8ecae5f812b631

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-manylinux_2_28_x86_64.whl:

Publisher: publish-pyqt6.yml on pyapp-kit/PyQlementine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ef3375119377ac1a013fdac1e5ebc9d1acb2036447ca2a98fd5844516657006
MD5 c83252ae524289a422120e42f20497ca
BLAKE2b-256 441e981b3f66632adf4d4ef5ec972a55eecbad644a1324c09d68a4aa468b8368

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyqt6_qlementine-1.4.3.0rc2-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: publish-pyqt6.yml on pyapp-kit/PyQlementine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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