Closed PieceOfGood closed 2 years ago
I don't have much experience with asyncio
, so it isn't obvious to make an example for this.
As far as I can tell, the pysciter already has its own main loop.
By the way, Sciter 5 (the one with Vulkan support) will be more asynchronous, it seems: https://github.com/c-smile/sciter-js-sdk/blob/c15de7010e733c6b8cdc49758b73662e51080b40/include/sciter-x-def.h#L492-L511
One option of the top of my head would be to run asyncio in a dedicated thread while running UI in the main thread.
asyncio.run_coroutine_threadsafe
to help with that.
Thanks for the help.
I recently found my old cefpython
craft. There was a similar situation, the launch of the wrapper used its own event loop, so it was impossible to add another one. It turns out that I ran it in a separate thread and used queues to transmit commands. Basically, this is what you recommend above. Definitely it should work in this case as well.
For example, I use
aiohttp
andtortoise-orm
for most my develop. Now I use async wrapper own invention forChrome DevTools protocol
to build HTML-UI in some browser window. Through domainRuntime
I receive notifications from the browser console, into which I send the names of functions serialized into a string and lists of their arguments that need to be called upon events in UI. And it works well. But if I need to write something simpler, for example, a widget for the desktop, then launching an entire browser for it seems very wasteful, but at the same time I just want HTML-UI.As far as I can tell, the
pysciter
already has its own main loop. Could you provide a working example if this is possible?