-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.py
33 lines (24 loc) · 808 Bytes
/
sample.py
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
32
33
from PyQt5.QtWidgets import QPushButton, QGridLayout, QApplication
from pyqt_windows_os_light_dark_theme_window.main import Window
class MainWindow(Window):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
btn = QPushButton('Theme Toggle')
btn.setCheckable(True)
btn.toggled.connect(self.__themeToggled)
lay = QGridLayout()
lay.addWidget(btn)
self.setLayout(lay)
self.changedToDark.connect(self.__darkThemeOn)
def __themeToggled(self, f):
self.setDarkTheme(f)
def __darkThemeOn(self, f):
print(f'Is current theme dark?: {f}')
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec())