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
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