NiceGUI – easy-to-use, Python-based UI framework
github.com
github.com
- UI = fn(state)
- UI = [black box of state] + fn(something)
I sure wasn’t prepared for bare render statements with no assignments or return values! I looked into the examples for how things get removed or reordered in the most likely places I’d expect to find them and… I didn’t find them?
I mean, it’s definitely conceivable this could be “easy to use” if these imperative render statements are ~equivalent to a re-render, but it bucks against a lot of design UI API principles I’ve seen flourishing regardless of the tech stack, and raises a lot of questions about what happens after state changes invalidate previous imperative calls.
It’s entirely possible there’s something I’m missing! I only took a curious glance. But that glance definitely left me with the impression that either there’s more magic than described or there’s a lot of imperative state necessary to handle anything past init.
We maintain a slot stack (https://github.com/zauberzeug/nicegui/blob/main/nicegui/slot...) to keep track of the current context (see http://127.0.0.1:8080/documentation#auto-context). When creating a new element, it finds its parent slot on the slot stack (https://github.com/zauberzeug/nicegui/blob/main/nicegui/elem...).
What do you think. Does it make sense? We appreciate your feedback!
Maybe imperative UI declaration needs a little extra care to keep its state consistent after all :D
Please take my silly glib response as a friendly jab not a meanspirited one… but this made me chuckle a couple times! Good luck with your project nonetheless
Looking at the examples, for quick UIs, REMI seems simpler. And PySimpleGUI (https://github.com/PySimpleGUI/PySimpleGUI) offers REMI as a backend to deploy on web too (PySimpleGUI is pretty simple to learn).