-- coding: utf-8 --
"""
【簡介】
垂直布局管理例子
"""
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QPushButton
class Winform(QWidget):
def init(self, parent=None):
super(Winform, self).init(parent)
self.setWindowTitle("垂直布局管理例子")
self.resize(330, 150)
# 垂直布局按照從上到下的順序進行添加按鈕部件。
vlayout = QVBoxLayout()
vlayout.addWidget(QPushButton(str(1)))
vlayout.addWidget(QPushButton(str(2)))
vlayout.addWidget(QPushButton(str(3)))
vlayout.addWidget(QPushButton(str(4)))
vlayout.addWidget(QPushButton(str(5)))
self.setLayout(vlayout)
if name == "main":
app = QApplication(sys.argv)
form = Winform()
form.show()
sys.exit(app.exec_())