-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest.py
34 lines (26 loc) · 880 Bytes
/
test.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
34
from PyQt5.QtGui import QFont
from PyQt5.QtWidgets import QMainWindow, QApplication, QHBoxLayout, QWidget, QTextEdit
from pyqt_font_dialog.fontWidget import FontWidget
class Window(QMainWindow):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
self.__te = QTextEdit()
fontWidget = FontWidget()
fontWidget.fontChanged.connect(self.fontChanged)
# fontWidget.setCurrentFont(QFont('Arial', 18))
lay = QHBoxLayout()
lay.addWidget(self.__te)
lay.addWidget(fontWidget)
mainWidget = QWidget()
mainWidget.setLayout(lay)
self.setCentralWidget(mainWidget)
def fontChanged(self, font):
self.__te.setFont(font)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
ex = Window()
ex.show()
sys.exit(app.exec_())