How use asyncio with pyqt6?

Question:

qasync doesn’t support pyqt6 yet and I’m trying to run discord.py in the same loop as pyqt but so far I’m not doing the best. I’ve tried multiprocess, multithread, and even running synchronous code from non-synchronous code but I either end up with blocking code that makes the pyqt program non responsive or it just outright doesn’t work. Can somebody please point me in the right direction?

Asked By: Lino

||

Answers:

qasync does not currently support PyQt6 but I have created a PR that implements it.

At the moment you can install my version of qasync using the following command:

pip install git+https://github.com/eyllanesc/qasync.git@PyQt6

Probably in future releases my PR will be accepted so there will already be support for PyQt6

They already accepted my PR so you can already install the latest version of qasync that has support for PyQt6.

Answered By: eyllanesc
os.environ.setdefault("QT_API", "PyQt6")
from asyncqt import QEventLoop
Answered By: h2magic
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.