开发者

PyQt blocking version of show()

开发者 https://www.devze.com 2023-01-02 02:55 出处:网络
I\'ve got a fairly cpu-intensive application, but all of the cpu-intensive stuff is started by clicking a QPushButton. When the button is clicked, a hidden QLabel is show()n.

I've got a fairly cpu-intensive application, but all of the cpu-intensive stuff is started by clicking a QPushButton. When the button is clicked, a hidden QLabel is show()n.

Apparently, show() is non-blocking. Unfortunately, this means that the cpu-intensive stuff is practically half-done before the label show()s up.

How can I make show blocking? Or how can I make the label show() right when I click the button?

Relevant code:

def parseFile(self):
    self.refreshLabel.show() #h开发者_如何学运维idden by default
    self.parse_triggered.emit()

parse_triggered causes the parent class to call the parse() function, which is pretty cpu-intensive.


Try calling processEvents() after the call to show.

0

精彩评论

暂无评论...
验证码 换一张
取 消