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_()