Skip to main content

PyQt style setter

Project description

pyqt-style-setter

PyQt style setter

Note

Currently the only style you can set is dark-gray(pyqt-dark-gray-theme), light-gray(pyqt-light-gray-theme).

Requirements

  • PyQt5 >= 5.8

Setup

python -m pip install pyqt-style-setter

Included Packages

Usage

  • StyleSetter.setWindowStyle(main_window: QWidget, theme: str = 'dark', exclude_type_lst: list = []) - main_window is the widget which user want to set the style. exclude_type_lst's items are excluded from applying style. Item type should be type(ex. QAbstractButton). Currently it only works for QAbstractButton.

Example

※ I use the pyqt-timer's settings dialog as an example.

PyQt default theme

from PyQt5.QtWidgets import QApplication

from pyqt_timer.settingsDialog import SettingsDialog



if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    window = SettingsDialog()

    window.show()

    app.exec_()

image

Dark-gray theme

from PyQt5.QtWidgets import QApplication

from pyqt_style_setter import StyleSetter

from pyqt_timer.settingsDialog import SettingsDialog



if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    window = SettingsDialog()

    StyleSetter.setWindowStyle(window) # add this

    window.show()

    app.exec_()

image

Using this with pyqt-custom-titlebar-setter

from PyQt5.QtWidgets import QApplication

from pyqt_custom_titlebar_setter import CustomTitlebarSetter

from pyqt_style_setter import StyleSetter

from pyqt_timer.settingsDialog import SettingsDialog



if __name__ == "__main__":

    import sys



    app = QApplication(sys.argv)

    dialog = SettingsDialog()

    StyleSetter.setWindowStyle(dialog)

    titleBarWindow = CustomTitlebarSetter.getCustomTitleBarWindow(dialog, icon_filename='settings.svg')

    titleBarWindow.show()

    app.exec_()

image

For those who use macOS

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-style-setter-0.0.15.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

pyqt_style_setter-0.0.15-py3-none-any.whl (4.2 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