-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHorizontal_HBoxLayout.py
More file actions
46 lines (35 loc) · 1.28 KB
/
Copy pathHorizontal_HBoxLayout.py
File metadata and controls
46 lines (35 loc) · 1.28 KB
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
import sys
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow, QDialog, QMessageBox, QPushButton, QVBoxLayout, QHBoxLayout, QGroupBox
class Window(QDialog):
def __init__(self):
super().__init__()
self.title = "PyQt5 Layouts"
self.top = 100
self.left = 100
self.width = 600
self.height = 600
self.initWindow()
def initWindow(self):
self.setWindowTitle(self.title)
self.setWindowIcon(QtGui.QIcon("Python-symbol.jpg"))
self.setGeometry(self.top, self.left, self.width, self.height)
self.HorizontalLayout()
vBox = QVBoxLayout()
vBox.addWidget(self.groupBox)
self.setLayout(vBox)
self.show()
def HorizontalLayout(self):
self.groupBox = QGroupBox("What is Sport")
hBoxLayout = QHBoxLayout()
button1 = QPushButton("FOOTBALL", self)
button1.resize(600,50)
hBoxLayout.addWidget(button1)
button2 = QPushButton("CRICKET", self)
hBoxLayout.addWidget(button2)
button3 = QPushButton("TENNIS", self)
hBoxLayout.addWidget(button3)
self.groupBox.setLayout(hBoxLayout)
app = QApplication(sys.argv)
window = Window()
sys.exit(app.exec())