我有一些这样的代码:
class MyApp(Ui_MainWindow):
def __init__(self):
pass
def setupUi(self, *args):
super(MyApp, self).setupUi(*args)
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.doCheck)
def doCheck(self):
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Checking...", None, QtGui.QApplication.UnicodeUTF8))
# Code to do real checking here... (it s a network app)
# When check done, display result in a "QTextBrowser"
# ....
# Change text of Button to "Done!"
self.pushButton.setText(QtGui.QApplication.translate("MainWindow", "Done!", None, QtGui.QApplication.UnicodeUTF8))
But the result not as I expect. My app do network checking and display result ok, but the button did not change text to "Checking..." when the check begin; it s only change text to "Done!" when everything is finished!