鋒哥原創的PyQt6視頻教程:
2024版 PyQt6 Python桌面開發 視頻教程(無廢話版) 玩命更新中~_嗶哩嗶哩_bilibili2024版 PyQt6 Python桌面開發 視頻教程(無廢話版) 玩命更新中~共計41條視頻,包括:2024版 PyQt6 Python桌面開發 視頻教程(無廢話版) 玩命更新中~、第2講 PyQt6庫和工具庫QTDesigner安裝與配置、第3講 PyQt6第一個程序HelloWorld實現等,UP主更多精彩視頻,請關注UP賬號。https://www.bilibili.com/video/BV11C4y1P7fj/
HorizontalLayout控件表示水平布局,其基類是QHBoxLayout,它的特點是:放入該布局管理器中的控件默認水平排列。
水平布局的屬性方法和前面講的垂直布局基本一致。
UI生成參考代碼:
from PyQt6 import QtCore, QtGui, QtWidgetsclass Ui_Form(object):def setupUi(self, Form):Form.setObjectName("Form")Form.resize(844, 303)self.horizontalLayoutWidget = QtWidgets.QWidget(parent=Form)self.horizontalLayoutWidget.setGeometry(QtCore.QRect(100, 70, 571, 141))self.horizontalLayoutWidget.setObjectName("horizontalLayoutWidget")self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalLayoutWidget)self.horizontalLayout.setContentsMargins(10, 10, 10, 10)self.horizontalLayout.setSpacing(16)self.horizontalLayout.setObjectName("horizontalLayout")self.pushButton = QtWidgets.QPushButton(parent=self.horizontalLayoutWidget)self.pushButton.setObjectName("pushButton")self.horizontalLayout.addWidget(self.pushButton)self.textEdit = QtWidgets.QTextEdit(parent=self.horizontalLayoutWidget)self.textEdit.setObjectName("textEdit")self.horizontalLayout.addWidget(self.textEdit)self.textEdit_2 = QtWidgets.QTextEdit(parent=self.horizontalLayoutWidget)self.textEdit_2.setObjectName("textEdit_2")self.horizontalLayout.addWidget(self.textEdit_2)self.horizontalLayout.setStretch(1, 2)self.horizontalLayout.setStretch(2, 1)self.retranslateUi(Form)QtCore.QMetaObject.connectSlotsByName(Form)def retranslateUi(self, Form):_translate = QtCore.QCoreApplication.translateForm.setWindowTitle(_translate("Form", "Form"))self.pushButton.setText(_translate("Form", "PushButton"))