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
-
pyqt-svg-button - To exclude svg icon set button, also known as
SvgButton
. It should use its own style or else svg icon will be disappeared by overwritten style.
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 betype
(ex.QAbstractButton
). Currently it only works forQAbstractButton
.
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_()
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_()
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_()
For those who use macOS
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-style-setter-0.0.15.tar.gz
.
File metadata
- Download URL: pyqt-style-setter-0.0.15.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/0.0.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76c89d541f886df7ddfc1c96ea12934d4ce3a19cd14d56c30839c530c4eb69ec |
|
MD5 | 225fb64645657cff6c673f4c4883ce3b |
|
BLAKE2b-256 | e44310404a08906c7d36872b22b7013680e468f852d0b47dd406fb540d56d3bb |
File details
Details for the file pyqt_style_setter-0.0.15-py3-none-any.whl
.
File metadata
- Download URL: pyqt_style_setter-0.0.15-py3-none-any.whl
- Upload date:
- Size: 4.2 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 | c791e9e4a9dc02fa065b0f9085a62e4b8e52ad20f1bcc07d937e29bb4d3ed64f |
|
MD5 | 1bd5a6b08e7ba311ebb8577659439c1a |
|
BLAKE2b-256 | 62c7b7e1d212867a150b23a83f4ee09ad94f206c69c9be6a6d6e36fb7d0be3b0 |