我正在使用以下简单代码来显示警告框:
w = QWidget()
result = QMessageBox.warning(w, 'a', x, QMessageBox.Ok)
有什么办法可以动态更改MESSAGE?我想弹出一个窗口,该窗口将通知用户邻接在后台运行的任务的进度。
编辑:
好吧,我试图通过以下脚本进行测试:
def handleButton(self):
self.msgBox = QMessageBox(self)
self.msgBox.setWindowTitle("Title")
self.msgBox.setIcon(QMessageBox.Warning)
self.msgBox.setText("Start")
self.msgBox.show()
x = 0
for x in range (100):
x = x + 1
print (x)
self.msgBox.setText(str(x))
self.msgBox.show()
time.sleep(1)
文本仅在完成“ for循环”后显示,为什么?
相关分类