PyQt4(简单布局)

复制代码
import sys
from PyQt4 import QtCore, QtGui

app = QtGui.QApplication(sys.argv)
widget = QtGui.QWidget()
widget.resize(600, 400)

edit = QtGui.QTextEdit()
btn1=QtGui.QPushButton("button1")
btn2=QtGui.QPushButton("button2")

hbox=QtGui.QHBoxLayout()
hbox.addWidget(btn1)
hbox.addWidget(btn2)

vbox=QtGui.QVBoxLayout()
vbox.addWidget(edit)
vbox.addLayout(hbox)
widget.setLayout(vbox)

app.connect(btn1,QtCore.SIGNAL('clicked()'),app,QtCore.SLOT('quit()'))
widget.show()
app.exec_()
复制代码

PyQt4(简单布局)_第1张图片

转载于:https://www.cnblogs.com/tiandsp/p/7580562.html

你可能感兴趣的:(PyQt4(简单布局))