|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
执行以下程序报错:app = QtGui.QApplication(sys.argv)
AttributeError: 'module' object has no attribute 'QApplication'
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(400, 300)
self.label = QtWidgets.QLabel(Dialog)
self.label.setGeometry(QtCore.QRect(60, 130, 54, 12))
self.label.setObjectName("label")
self.pushButton = QtWidgets.QPushButton(Dialog)
self.pushButton.setGeometry(QtCore.QRect(150, 200, 75, 23))
self.pushButton.setObjectName("pushButton")
self.lineEdit = QtWidgets.QLineEdit(Dialog)
self.lineEdit.setGeometry(QtCore.QRect(140, 130, 113, 20))
self.lineEdit.setObjectName("lineEdit")
self.retranslateUi(Dialog)
self.pushButton.clicked.connect(self.lineEdit.clear)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.label.setText(_translate("Dialog", "TextLabel"))
self.pushButton.setText(_translate("Dialog", "clear"))
if __name__ == '__main__':
import sys
app = QtGui.QApplication(sys.argv)
From = QtGui.QWidget()
ui = Ui_Dialog()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())
|
|