Thanks for your answers! I didn't have the time to test any of your
suggestions so far but they already gave me something to think about. At
least now I'm much more clearer on what I am actually looking for.
On 23.12.2013 20:59, Terry Reedy wrote:
What would be easiest for user-developers would be if someone were
able to wrap a gui loop in a way to give it the needed interface, so
the gui loop itself replaced and became the asyncio loop.
That's a good idea, maybe I will try this. On the other hand this means that
for every gui toolkit there must be a separate wrapper. I hoped this can
be avoided.
On 23.12.2013 17:47, Chris Angelico wrote:
You may be able to wrap your GUI code up so it fits inside asyncio.
Rather than run a simple event loop, you could have your own loop that
does some kind of checking: PyGTK has functions for peeking at events
and doing just one iteration of the main loop, so you could pump all
events with something like this:
while gtk.events_pending(): gtk.main_iteration()
No doubt other toolkits have something similar.
On 23.12.2013 20:59, Terry Reedy wrote:
I think tk(inter) has 'run pending events' or something.
I didn't know functions like this exist in gui toolkits. Am I right in
thinking that using these functions you don't have to use the built-in
event loop. Instead you can write your own loop and just call 'run
pending events' continuously?
I think what I actually want is the other way around. I want my library
to be easy to use in existing gui applications that already have their
own main loop. Their core should not need to be adapted for this. So I
think I should provide a function like 'run pending events' in my api.
For example in a PyQt application this could be called periodically by
using a QTimer.
So I would use asyncio only if my library is used non-interactively with
it's internal event loop.
Well, maybe I could reuse asyncio's transports and protocols in both
situations. I don't know if they depend on asyncio's event loop.
Note: I didn't concern myself with all this stuff yet. Just wrote down
what came to my mind. If there are any errors in my reasoning please
correct me. I will try some approaches after the christmas holidays and
get back to you then...
Thanks and regards,
Tobias
--
https://mail.python.org/mailman/listinfo/python-list