python PyQt5 QHBoxLayout 水平布局管理
生活随笔
收集整理的這篇文章主要介紹了
python PyQt5 QHBoxLayout 水平布局管理
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
參考文章:PyQt5布局管理之QHBoxLayout(一)
https://doc.qt.io/qtforpython/PySide2/QtWidgets/QHBoxLayout.html?highlight=qhboxlayout#PySide2.QtWidgets.QHBoxLayout
繼承關(guān)系
詳細(xì)描述
此類用于構(gòu)造水平框布局對象。 有關(guān)詳細(xì)信息,請參見QBoxLayout。
該類的最簡單用法是這樣的:
window = QWidget() button1 = QPushButton("One") button2 = QPushButton("Two") button3 = QPushButton("Three") button4 = QPushButton("Four") button5 = QPushButton("Five")layout = QHBoxLayout() layout.addWidget(button1) layout.addWidget(button2) layout.addWidget(button3) layout.addWidget(button4) layout.addWidget(button5)window.setLayout(layout) window.show()首先,我們在布局中創(chuàng)建所需的小部件。 然后,我們創(chuàng)建QHBoxLayout對象,并將小部件添加到布局中。 最后,我們調(diào)用setLayout()將QHBoxLayout對象安裝到小部件上。 那時,布局中的小部件將重新進(jìn)行父級化,以將窗口作為其父級。
See alsoQVBoxLayoutQGridLayoutQStackedLayoutLayout ManagementBasic Layouts Example class QHBoxLayout? QHBoxLayout(parent)param parent QWidget構(gòu)造一個新的水平框。 您必須將其添加到另一個布局。
使用父parent構(gòu)造一個新的頂層水平框。
總結(jié)
以上是生活随笔為你收集整理的python PyQt5 QHBoxLayout 水平布局管理的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【记忆断层、记忆裂痕】
- 下一篇: python PyQt5 QLabel(