-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04. QHBoxLayout.py
38 lines (27 loc) · 918 Bytes
/
04. QHBoxLayout.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
from PyQt6.QtWidgets import QApplication, QWidget, QHBoxLayout, QPushButton
from PyQt6.QtGui import QIcon
import sys
class Window(QWidget):
def __init__(self):
super().__init__()
self.setGeometry(200,200, 700,400)
self.setWindowTitle("PyQt6 QHBoxLayout")
self.setWindowIcon(QIcon('images/python.png'))
#----Create QHBoxLayout Object-----
hbox = QHBoxLayout()
btn1 = QPushButton("Click One")
btn2 = QPushButton("Click Two")
btn3 = QPushButton("Click Three")
btn4 = QPushButton("Click Four")
btn5 = QPushButton("Click Five")
hbox.addWidget(btn1)
hbox.addWidget(btn2)
hbox.addWidget(btn3)
hbox.addWidget(btn4)
hbox.addWidget(btn5)
hbox.addSpacing(100)
self.setLayout(hbox)
app = QApplication(sys.argv)
Window = Window()
Window.show()
sys.exit(app.exec())