| 1 |
from PySide6.QtWidgets import QApplication, QMainWindow |
| 2 |
from PySide6.QtUiTools import QUiLoader |
| 3 |
from qt_material import apply_stylesheet |
| 4 |
|
| 5 |
|
| 6 |
extra = { |
| 7 |
|
| 8 |
|
| 9 |
'danger': '#dc3545', |
| 10 |
'warning': '#ffc107', |
| 11 |
'success': '#17a2b8', |
| 12 |
|
| 13 |
|
| 14 |
'font_family': 'monoespace', |
| 15 |
'font_size': '13px', |
| 16 |
'line_height': '13px', |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
class RuntimeStylesheets(QMainWindow): |
| 22 |
|
| 23 |
def __init__(self): |
| 24 |
"""""" |
| 25 |
super().__init__() |
| 26 |
self.main = QUiLoader().load('main_window_extra.ui', self) |
| 27 |
|
| 28 |
self.main.pushButton_danger.setProperty('class', 'danger') |
| 29 |
self.main.pushButton_warning.setProperty('class', 'warning') |
| 30 |
self.main.pushButton_success.setProperty('class', 'success') |
| 31 |
|
| 32 |
|
| 33 |
if __name__ == "__main__": |
| 34 |
app = QApplication() |
| 35 |
|
| 36 |
apply_stylesheet(app, theme='light_blue.xml', extra=extra) |
| 37 |
|
| 38 |
frame = RuntimeStylesheets() |
| 39 |
frame.main.show() |
| 40 |
app.exec_() |
| 41 |
|