I have little experience in GUI programming but I’m writing a GUI application with PyQt. With this application, user can open a binary file and do some editing with it.
When the file is opened, I do some processing that takes a while (~15s). So when the user pick the file and press the “Open” button in the file open dialog, the GUI is frozen. What’s the best way to achieve a better user experience?
Thanks
Load in the background showing the progress via a Gauge in the statusbar.
To to this, you can initiate the loading using QThread. Your thread class can look as follows (assuming
parentwill have an attributeprogress):The question whether to use
QThreadortrheading.Threadis discussed hereedit (according to hint of @Nathan):
On the
parent, a timerfunction should check, say each 100ms, the value of self.parent.progress and set the progressbar accordingly. This way, the progressbar is set from within the main thread of the GUI.