PyQT在调用其他函数之前强制渲染一些小部件

时间:2017-12-17 11:28:39

标签: python pyqt

我正在为管理一些模拟的Python项目设计GUI。由于模拟需要一些时间,我希望有一个窗口告诉用户等待,在模拟开始时弹出。

目前,代码就像

def start_simulation(self):
    self.calculation_running_dialog.show()
    heavy_function_call(self)
    self.calculation_running_dialog.hide()

但是,我面临以下问题:当模拟开始时,窗口会出现,但在Ubuntu中使用透明的主体进行渲染,在Windows中使用空(白色)主体进行渲染。仅在重函数调用终止后,窗口将正确呈现。 如何在模拟开始前强制窗口正确显示?

最近,我在这里问了一个类似的问题:PyQT force update textEdit before calling other function。 为此,repaint()函数证明是解决方案。但对于当前的问题,self.calculation_running_dialog.repaint()self.calculation_running_dialog.update()self.calculation_running_dialog.textLabel.repaint()都无法解决问题。

有什么建议吗?

0 个答案:

没有答案
相关问题