News for hackers. Stuff that matters.
Re:Iced: A cross-platform GUI library for Rust, inspired by Elm by ptx on Friday August 27, 2021 @02:19PM (#28331242)
Hmm, I'm not so sure that Tkinter example really solves the problem of performing background work without blocking the UI. Sure, the UI thread doesn't block, but instead the UI state (as the user continues interacting with it) can drift out of sync with the model when the controller thread is busy with other work.

The real issue in that example seems to be that the event loop needs to wait for both UI events and read/write readyness on the serial port. This could probably be handled either with createfilehandler[1] (although it doesn't work on Windows) or by dedicating a thread to handling the serial port and posting messages to the Tkinter event loop as suggested at the end.

[1] https://docs.python.org/3/library/tkinter.html#file-handlers

Re:Iced: A cross-platform GUI library for Rust, inspired by Elm by z3ugma on Friday August 27, 2021 @02:58PM (#28331688)
I think your last suggestion is dead on - think about the browser event loop where Messages can be triggered all the time from clicks, hovers etc. If you have 4 threads and all those threads are pushing Messages then the update thread only has to push the state change notifications and doesn't have to do much blocking of its own