我认为 PySide 小部件存在重绘问题。如何强制小部件(或整个窗口/应用程序)在方法中间重新绘制?
def on_button_clicked():
window.resultTextEdit.setPlainText("Parsing file...")
# indicate delay, this message should be visible while parsing
# but in fact it never appears
# can I force a repaint here?
result = parse() # (takes a little while)
window.resultTextEdit.setPlainText(result)
# display the results once done
app = QApplication(sys.argv)
window = QtUiTools.QUiLoader().load("application.ui")
window.userButton.clicked.connect(on_button_clicked)
window.show()
sys.exit(app.exec_())
我是一名优秀的程序员,十分优秀!