PyQt dark-gray theme
Project description
pyqt-dark-gray-theme
PyQt dark-gray theme
Note
This is deprecated except for my personal project. If you want to use the dark-gray style, use qtsasstheme.
Requirements
- PyQt5 >= 5.8
Setup
python -m pip install pyqt-dark-gray-theme
Included Packages
- qtsasstheme - 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
File details
Details for the file pyqt-dark-gray-theme-0.0.4.tar.gz
.
File metadata
- Download URL: pyqt-dark-gray-theme-0.0.4.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a0fd7e79e4c5de9975f267dab3a1c4136a74fdeb3736408e0b8a6ef4d39b537 |
|
MD5 | af43452341e015e9cb6802780e47b164 |
|
BLAKE2b-256 | 016654d26c7533705fe5fe660796cf1098c36c3cab890d6012d370ad0e24b6f2 |
File details
Details for the file pyqt_dark_gray_theme-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: pyqt_dark_gray_theme-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9e2084e52addb086a1146ad66008f1ad66e3891df4621a75eae1661e1356b05 |
|
MD5 | 8f3f678e3dbfc7947d448d6f63f3c59f |
|
BLAKE2b-256 | c6830f4a22e4cd07bbaf004f2795fb55c4e425cbb3ae2252ee754a3bd26191a1 |