Replies: 2 comments 6 replies
-
It's possible, you just have to run the async runtime off the main thread (because most operating systems want the main thread to handle UI events, and the event loop blocks). You can spawn the tokio executor in a thread instead of trying to transform the main function into an async function with the Updating the UI is just a matter of communicating between the two threads using channels. There shouldn't be any surprises here. |
Beta Was this translation helpful? Give feedback.
6 replies
-
@gh0st42 surely possible, here it's: https://github.com/ar37-rs/eframe_tokio_app |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It's really amazing how easy and fun it is to write GUI stuff with egui!
As I'm currently working with a lot of different gRPC services, I am making heavy use of the tonic. This crate uses tokio and async/await.
It would be super nice to put an egui frontend on top of some of our code.
Is it even possible to use egui and eframe with async code in a more or less elegant way?
eframe::run_native
does work in#[tokio::main]
but how can I update UI stuff in the most idiomatic way fromtokio::spawn
ed async functions.I only found the HTTP fetching stuff in the egui_web code but no examples using tokio runtime on the desktop.
Beta Was this translation helpful? Give feedback.
All reactions