On 2020-07-08 21:11, artis.pain...@gmail.com wrote:
I might be wrong but since I have not found anygroup newsgroup dedicated to 
PyQt5.

My small program is expected to show a window GUI for 4 seconds before changing 
it, so I naively coded:

"...
...
# codes to set up the GUI
...
F0.show() # F0 being a QMainWindow object
time.sleep(4)
...
# codes to change the GUI set up
...
F0.update()

"

What happens: The a blank window is displayed, freezes for 4 seconds then 
second set up is displayed, the original set up is not displayed.

Why is not the original set up displayed?

Obviously, if I remove the codes for the second set up, and the "time.sleep(4)" 
instruction, the original set up is displayed immediatly after I launch the execution.

If you tell the program to sleep, or your code is busy processing, then the GUI won't be unresponsive.

A GUI is based on events. Something happens, e.g. a button is pressed, a handler in your code is called, it does something, and then it passes control back to the GUI code to update the display and wait for the next event.

Basically, your code needs to set up the GUI, set some kind timer (I'm not familiar with Qt), and return control to Qt. When the timer expires, your code will be called, and then you can change the display, and return control to Qt again.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to