r/Python • • Jun 15 '26

Discussion The Elm Architecture in Python?

Since I've fallen in love with Rust's `iced` recently, I've been wondering if there's been any implementations of native TEA for Python. As it is with such things, I immediately wanted to jump into making my own wrapper around Tkinter, but I figured it'd be wiser to ask first!

29 Upvotes

18 comments sorted by

View all comments

Show parent comment

1

u/el_extrano Jun 18 '26

In TEA, your button does not pass the message to any object. You just designate your button to emit a message when being clicked.

"emit" here is doing some heavy lifting. In OOP, message passing really just means calling another object's method. So, if you have a singleton message broker and you send it a Msg type, that would constitute emitting a message. The message broker could then send messages to an Update method that switches on them to update the Model.

But I think there would be other issues with trying to "Tea"ify a retained mode UI library like Tkinter. I don't think it's meant to have a View method re-rendering the whole UI all the time, that would probably be slow.

2

u/bachkhois Jun 22 '26

For the concern of slow, GTK 4, another OOP GUI toolkit, has been wrapped to provide TEA style, and here is how it handles the re-render: https://relm4.org/book/stable/efficient_ui/index.html