File: custom_css.py

package info (click to toggle)
qt-material 2.14-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 33,000 kB
  • sloc: python: 1,153; xml: 261; makefile: 22; sh: 8
file content (31 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtUiTools import QUiLoader
from qt_material import apply_stylesheet
import os


########################################################################
class RuntimeStylesheets(QMainWindow):
    # ----------------------------------------------------------------------
    def __init__(self):
        """"""
        super().__init__()
        self.main = QUiLoader().load('main_window.ui', self)
        self.main.pushButton_2.setProperty('class', 'big_button')


if __name__ == "__main__":
    app = QApplication()

    # apply_stylesheet(app, theme='light_blue.xml')

    # stylesheet = app.styleSheet()
    # # app.setStyleSheet(stylesheet + "QPushButton{color: red; text-transform: none;}")
    # with open('custom.css') as file:
    # app.setStyleSheet(stylesheet + file.read().format(**os.environ))

    apply_stylesheet(app, theme='light_blue.xml', css_file='custom.css')

    frame = RuntimeStylesheets()
    frame.main.show()
    app.exec_()