On 12.03.2017 08:02, Brendan Simon (eTRIX) wrote:
> I'm playing with MicroPython using asyncio coroutines to do some tasks
> (e.g. scan a 4x4 keypad matrix and display stuff on a LCD).
I also tried my PyBoard this week for the first time...
> I want to also be able to simulate my environment using wxPython Phoenix
> to provide fake LCD and Keypad.
>
> How can I use wxPython Phoenix with Python 3.5/3.7 asyncio
> functionality, so that I can run the coroutines and also hand GUI events?
Your example would not work, as MainLoop() does only return once you
close your wx application.
As of now, there's no asyncio / wx integration that I'm aware of.
The MainLoop is implemented in C++, so it's probably not trivial to add
support.
I have been using Qamash for some small programs (i.e. the PyQt/asyncio
integration). asyncio support would probably be the coolest and most
important feature to add to wxPython, once Phoenix is released.
As workaround, you could use a separate thread for the asyncio main
loop, but that's not as nice as native support.
Alternatively, you may try to run the asyncio loop from within an
EVT_IDLE handler. If you try this, please post your results.
Instead of calling loop.run_forever you would need to call _run_once on
each idle event. See the implementation of run_forever.
Regards,
Dietmar
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
For more options, visit
https://groups.google.com/d/optout.