09Using vertical layout in QtDesigner

Use vertical layout method the same as horizontal layout

Also use the designer to design the ui, then convert it to py, and then write the following code for display

import sys
import vertical_layout_demo
from PyQt5.QtWidgets import QApplication,QMainWindow

if __name__ == '__main__':
    # 创建运行程序
    app = QApplication(sys.argv)
    # 创建主窗口
    mainwindow = QMainWindow()
    ui = vertical_layout_demo.Ui_MainWindow()
    # 向主窗口中添加控件
    ui.setupUi(mainwindow)
    mainwindow.show()
    sys.exit(app.exec_())

Effect:

Guess you like

Origin blog.csdn.net/weixin_43959436/article/details/129462108