I have a small PyQt app
...
def __init__ (self):
...
self.btn_read_all.clicked.connect(self.get_all)
...
def get_all(self):
self.statusbar.showMessage('Please Wait...')
self.log('Text 1')
self.setEnabled(False)
self.tracker.read_all() # Vey slow function
self.show_all()
self.log('Text 2')
self.setEnabled(True)
self.statusbar.clearMessage()
My problem is that tracker.read_all
runs very slow. And I don't want the user to have a possibility to click something while it's running. So I want to show him some message like "Please Wait" and disallow him click any items. I also don't want OS thinks that my app hangs and should be stopped. I want them just wait a little. So first I tried to disable QMainWindow
before and re-enable after. But it doesn't work. You can see on the video (https://transfer.sh/ni0Zt/2018-05-08_18-49-59.mp4) that no changes are applied to UI while the whole function is finished even Text 1
and Text 2
appears at the same time.
So I have 2 questions:
- Why does it work like that? How can I fix that?
- Is there any special way to show the user that he should wait a little? Anything like sand-clock?