This question seems theoretical, since it should never be a problem in practice, because it smells like a fishy design or a quick workaround for a mistake.
Having said that, the reason is relatively simple: when you start to sleep, the Qt event loop cannot do its job, so your slot cannot be processed from the event queue by the event loop before you wake up from your blocking sleep.
This will not be a problem if you, say, were sleeping in another thread, although even that would be too strange at first, but here you are sleeping in a thread (block) where the event should be processed asynchronously.
There is not much point in sleeping in a Qt application. Qt is primarily intended for asynchronous operation, especially QIODevice interfaces such as QtNetwork.
When using Qt, forget about the existence of this statement :
time.sleep(10)
Whenever you plan to block waiting for a response, you can use the synchronization API, although even this is not fully synchronized to be fair:
I will probably even go further: I would probably not use Qt in a python application for anything other than a strictly user interface. That is, everything else can be achieved using python tools, usually better and easier with a python application. I think you should focus on the graphical interface, but this is certainly an opinion based opinion. Appropriate alternatives will be asynchronous, twisted, etc.
lpapp source share