@
David1119 昨晚我是放 init 里的
刚刚看你这么说我就把事件在 designer 里绑定,放在 setupUI 了,然后把 init 里的绑定注释掉,也不行。
到底我这个说代码问题呢,还是说系统问题。。。
附上 setupUI 的代码
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(547, 318)
self.label = QtWidgets.QLabel(Form)
self.label.setGeometry(QtCore.QRect(240, 210, 58, 16))
self.label.setObjectName("label")
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(70, 200, 112, 32))
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Form)
self.pushButton.clicked.connect(Form.printLabel2)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.label.setText(_translate("Form", "Label"))
self.pushButton.setText(_translate("Form", "PushButton"))