Not blocking GUI by network worker needing asyncio?
Kyle Altendorf
sda at fstab.net
Mon Jul 5 15:29:19 BST 2021
On 2021-07-05 04:39, Axel Rau wrote:
> Hi all,
>
> my knowledge who GIT, threads and asyncio playing together is still
> limited.
> I have long running network operations, using the dnspython package,
> which should not block the GUI.
>
> Now the question: If elapsed time of net work is not an issue, do I
> need the async version of dnspython and async/qasync in my worker
> thread (setup per moveToThread and using an QEventLoop)?
I personally prefer to be able to use async/await for everything and not
have to deal with threads. For asyncio there's qasync (from asyncqt
(from quamash)).
https://pypi.org/project/qasync/
But, if you do just push all your long running tasks into threads, sure,
you can just use blocking versions. Though, you still give up
cancellability as compared with async options.
Cheers,
-kyle
More information about the PyQt
mailing list