31 lines
1.1 KiB
Python
Raw Normal View History

2020-12-13 16:35:46 -05:00
from PySide6.QtWidgets import QApplication, QMainWindow
from PySide6.QtUiTools import QUiLoader
from PySide6.QtGui import QFontDatabase
2020-12-13 16:35:46 -05:00
from qt_material import QtStyleTools
########################################################################
class RuntimeStylesheets(QMainWindow, QtStyleTools):
# ----------------------------------------------------------------------
def __init__(self):
""""""
super().__init__()
self.main = QUiLoader().load('main_window.ui', self)
self.main.pushButton.clicked.connect(lambda: self.apply_stylesheet(self.main, 'dark_teal.xml'))
self.main.pushButton_2.clicked.connect(lambda: self.apply_stylesheet(self.main, 'light_red.xml', extra={'font_family': 'mono', }))
self.main.pushButton_3.clicked.connect(lambda: self.apply_stylesheet(self.main, 'light_blue.xml', extra={'font_family': 'Raleway', }))
2020-12-13 16:35:46 -05:00
if __name__ == "__main__":
app = QApplication()
2020-12-22 14:34:27 -05:00
# Local file
QFontDatabase.addApplicationFont('Raleway-Regular.ttf')
2020-12-13 16:35:46 -05:00
frame = RuntimeStylesheets()
frame.main.show()
2021-01-21 11:59:17 -05:00
2020-12-13 16:35:46 -05:00
app.exec_()