PyQt dark-gray theme
Project description
pyqt-dark-gray-theme
PyQt dark-gray theme
Requirements
- PyQt5 >= 5.8
Setup
python -m pip install pyqt-dark-gray-theme
Included Packages
- qt-sass-theme-getter - For get dark-gray theme css code
Usage
-
getThemeStyle() -> str
- use it toQMainWindow
,QDialog
. -
getIconButtonStyle() -> str
- use it toQPushButton/QToolButton
which has an icon. This is for button which contains icon only. -
getIconTextButtonStyle() -> str
- use it toQPushButton/QToolButton
which has no icon. This is for button which contains text only or icon and text. -
getMenuBarStyle(menu_bar: QMenuBar) -> str
use it toQMenuBar
. This is for dealing with menu bar. You have to give the menu bar you want to change its style. -
getMainWidgetStyle() -> str
use it to top levelQWidget
. This is for dealing with the case ofQWidget
as a main window.
Example
Code Sample
Example GUI app - pyqt-comic-viewer (which is QMainWindow
as a parent class)
from PyQt5.QtWidgets import QApplication, QPushButton
from pyqt_comic_viewer.comicBookViewer import ComicBookViewer
from pyqt_dark_gray_theme.darkGrayTheme import getThemeStyle, getIconButtonStyle, getIconTextButtonStyle, \
getMenuBarStyle
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = ComicBookViewer()
ex.setStyleSheet(getThemeStyle()) # whole theme
btns = ex.findChildren(QPushButton) # buttons
for btn in btns:
# check if text exists
if btn.text().strip() == '':
btn.setStyleSheet(getIconButtonStyle()) # no text - icon button style
else:
btn.setStyleSheet(getIconTextButtonStyle()) # text - icon-text button style
menu_bar = ex.menuBar() # menu bar
menu_bar_style = getMenuBarStyle(menu_bar)
menu_bar.setStyleSheet(menu_bar_style)
ex.show()
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-dark-gray-theme-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0ad1dc342f282e88c5d75f9363a4e54012a2cab9d101741101d78cc3ceb8c8b |
|
MD5 | 8ac44e44d8b46adf7d48f97dd3e9c0b5 |
|
BLAKE2b-256 | 3fc0659eef844751f634138fa9a8e42ec5fb68a8f27c5a4f8e64bb11376e18e1 |
Hashes for pyqt_dark_gray_theme-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2061fc24cdffa37bba56d4b006db03ef1ee5d559767b1d51451cad083d3aeade |
|
MD5 | b4c5a93ed1d0e2ebcbf09c5d9ecc7469 |
|
BLAKE2b-256 | 2cf3f03db5e1dcb7daac4cd5d79305988719667e46c259a7457c0db630767b4b |