Skip to main content

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

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.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

pyqt_dark_gray_theme-0.0.2-py3-none-any.whl (3.6 kB view hashes)

Uploaded Python 3

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