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_()
时间: 2024-11-05 14:48:47