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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fead0021e0320208deed7fa291db13474343406444be1feb0d80219cd7b3bfb |
|
MD5 | c04f8012e5d563b89dfb63927b690b93 |
|
BLAKE2b-256 | b867be8358a28fdcfff5d92c0eeac09d546a6d99da55f5b7854b48acc8ff6bab |
Hashes for pyqt_dark_gray_theme-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dee15d2a315a01e8d5df79e103929296f4f65bdd1671f778d3fc6b3d77839089 |
|
MD5 | d50c4cb496d49b0e58e26a183a99194d |
|
BLAKE2b-256 | d9d5e6ae06e631785fd047c46ae6decc127df86f7a31d58d425b3092aa0a0f85 |