-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path15_tab_widget.py
43 lines (32 loc) · 1.17 KB
/
15_tab_widget.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
import sys
from PySide6.QtWidgets import QApplication, QWidget, QPushButton, QMessageBox, QTabWidget, QHBoxLayout, QVBoxLayout, QListWidgetItem, QLineEdit, QLabel
class Widget(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Tab Widget Demo")
tab_widget = QTabWidget(self)
label = QLabel("Name:")
line_edit = QLineEdit()
line_edit.setPlaceholderText("Enter name here")
h_layout = QHBoxLayout()
h_layout.addWidget(label)
h_layout.addWidget(line_edit)
form_widget = QWidget()
form_widget.setLayout(h_layout)
tab_widget.addTab(form_widget, "hello")
button_A = QPushButton("A")
button_B = QPushButton("B")
button_C = QPushButton("C")
v_layout = QVBoxLayout()
v_layout.addWidget(button_A)
v_layout.addWidget(button_B)
v_layout.addWidget(button_C)
letter_widget = QWidget()
letter_widget.setLayout(v_layout)
tab_widget.addTab(letter_widget, "letter")
if __name__=='__main__':
app = QApplication(sys.argv)
window = Widget()
window.resize(200, 200)
window.show()
app.exec()