Skip to main content

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

Usage

  • getThemeStyle() -> str - use it to QMainWindow, QDialog.

  • getIconButtonStyle() -> str - use it to QPushButton/QToolButton which has an icon. This is for button which contains icon only.

  • getIconTextButtonStyle() -> str - use it to QPushButton/QToolButton which has no icon. This is for button which contains text only or icon and text.

  • getMenuBarStyle(menu_bar: QMenuBar) -> str use it to QMenuBar. 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 level QWidget. This is for dealing with the case of QWidget 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

image

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

pyqt-dark-gray-theme-0.0.4.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

pyqt_dark_gray_theme-0.0.4-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for pyqt-dark-gray-theme-0.0.4.tar.gz
Algorithm Hash digest
SHA256 6a0fd7e79e4c5de9975f267dab3a1c4136a74fdeb3736408e0b8a6ef4d39b537
MD5 af43452341e015e9cb6802780e47b164
BLAKE2b-256 016654d26c7533705fe5fe660796cf1098c36c3cab890d6012d370ad0e24b6f2

See more details on using hashes here.

File details

Details for the file pyqt_dark_gray_theme-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for pyqt_dark_gray_theme-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b9e2084e52addb086a1146ad66008f1ad66e3891df4621a75eae1661e1356b05
MD5 8f3f678e3dbfc7947d448d6f63f3c59f
BLAKE2b-256 c6830f4a22e4cd07bbaf004f2795fb55c4e425cbb3ae2252ee754a3bd26191a1

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