CabbageDevelopment / qasync

Python library for using asyncio in Qt-based applications.
BSD 2-Clause "Simplified" License
321 stars 45 forks source link

README Introduction example text #96

Closed jamesdbrock closed 10 months ago

jamesdbrock commented 11 months ago

Great package, thanks for maintaining it.

It seems to have no documentation though? Here's some slight documentation improvement.

hosaka commented 11 months ago

Related to https://github.com/CabbageDevelopment/qasync/issues/69

Hi @jamesdbrock, thanks for bringing this up. I haven't had time to address the lack of documentation. If you can expand a bit on your changes: perhaps add some basic examples to examples/ and add more structure to the readme, that would be great.

jamesdbrock commented 11 months ago

If you can expand a bit on your changes: perhaps add some basic examples to examples/ and add more structure to the readme, that would be great.

I'd love to, but can we merge this PR first and then I'll add more PRs for more documentation improvements?

hosaka commented 11 months ago

I think the addition of "can be used with set_event_loop" is not quite enough to pass as documentation improvements. The QEventLoop can be used with a bunch of other asyncio methods too. Rather than giving a one liner, I think we're better off having some toy examples that demonstrate the use of async slots, async timers etc. right in the README.

If you find time to add more of these to this PR, please do so and I will review it again.

jamesdbrock commented 11 months ago

Here's the README text introduced by this PR:


qasync allows coroutines to be used in PyQt/PySide applications by providing class QEventLoop, which is an implementation of the PEP 3156 AbstractEventLoop and can be used in set_event_loop.

import asyncio
import qasync

asyncio.set_event_loop(qasync.QEventLoop())
hosaka commented 10 months ago

Superseded by #102