-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
47 lines (31 loc) · 958 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
35
36
37
38
39
40
41
42
43
44
45
46
47
import sys
from PySide2.QtWidgets import (
QApplication, QMainWindow, QLabel,
QLineEdit, QVBoxLayout, QWidget,
QHBoxLayout
)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle("My App")
self.label = QLabel()
self.input = QLineEdit()
self.input.textChanged.connect(self.label.setText)
layout = QVBoxLayout()
layout.addWidget(self.input)
layout.addWidget(self.label)
label2 = QLabel()
label2.setText("Label 2")
label3 = QLabel()
label3.setText("Label 3")
child_layout = QHBoxLayout()
child_layout.addWidget(label2)
child_layout.addWidget(label3)
layout.addLayout(child_layout)
container = QWidget()
container.setLayout(layout)
self.setCentralWidget(container)
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()