libui.loop — Threading & Event Loop¶
Two-thread architecture: main thread owns libui, asyncio in background.
- libui.loop.invoke_on_main(fn, *args, **kwargs)¶
Block the calling thread until fn runs on the main UI thread.
Returns the result of fn(*args, **kwargs). If fn raises, the exception is re-raised in the caller.
If already on the main thread, runs fn directly (avoids deadlock).
- async libui.loop.invoke_on_main_async(fn, *args, **kwargs)¶
Await the result of fn running on the main UI thread (non-blocking).