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_()
复制代码

posted @ 2017-09-23 10:52  Dsp Tian  阅读(631)  评论(0编辑  收藏  举报