News for hackers. Stuff that matters.
Re:NiceGUI – easy-to-use, Python-based UI framework by eyelidlessness on Friday March 31, 2023 @10:03PM (#35396291)
I’m not the target audience so plenty of grains of salt, but I was curious and took a look. I haven’t worked in Python for a few years, but I figured I have enough background to anticipate some patterns. Foremost among them, I expected some variation of either:

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

Re:NiceGUI – easy-to-use, Python-based UI framework by rodja on Saturday April 01, 2023 @02:09AM (#35397602)
Hi Ken_At_EM, thanks for looking into our code! Our approach with context managers for defining "belonging" in NiceGUI resembles the nesting of elements in HTML. By implementing the __enter__ and __exit__ methods, we can manage the context when used with a "with" expression. In NiceGUI, elements pass down to the default_slot (https://github.com/zauberzeug/nicegui/blob/main/nicegui/elem...), which is a 1:1 representation of Vue slots.

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!

Re:NiceGUI – easy-to-use, Python-based UI framework by eyelidlessness on Saturday April 01, 2023 @03:04AM (#35397921)
> Hi Ken_At_EM […] see http://127.0.0.1:8080

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

Re:NiceGUI – easy-to-use, Python-based UI framework by Ken_At_EM on Friday March 31, 2023 @11:23PM (#35396780)
GUIs are Pythons greatest weakness. We need a solid electron/tauri clone with a JS front end and a Python backend and good deployment tools.
Re:NiceGUI – easy-to-use, Python-based UI framework by kissaprofeetta on Saturday April 01, 2023 @12:52AM (#35397253)
Re:NiceGUI – easy-to-use, Python-based UI framework by rodja on Saturday April 01, 2023 @02:13AM (#35397620)
pywebview (https://github.com/r0x0r/pywebview) is an excellent suggestion and is already being used in NiceGUI to create a native desktop window with "native=True" option (see http://127.0.0.1:8080/documentation#ui_run).
Re:NiceGUI – easy-to-use, Python-based UI framework by Ken_At_EM on Thursday April 06, 2023 @01:44PM (#35471793)
Awesome. Seems like a solid building block.
Re:NiceGUI – easy-to-use, Python-based UI framework by rodja on Saturday April 01, 2023 @02:11AM (#35397612)
We understand the need for a solid Electron-like solution with a Python backend and good deployment tools, and that's where NiceGUI aims to fill the gap with it's 1.2 release (https://news.ycombinator.com/item?id=35386990).
Re:NiceGUI – easy-to-use, Python-based UI framework by Ken_At_EM on Thursday April 06, 2023 @01:44PM (#35471789)
Very cool!
Re:NiceGUI – easy-to-use, Python-based UI framework by lxe on Saturday April 01, 2023 @03:32AM (#35398084)
I think JS ecosystem needs a gradio-like pattern such as this one. I'm tired of how incredibly artificially low-level frontend development has become. I don't want to solve functional programming puzzles to make a button do something,
Re:NiceGUI – easy-to-use, Python-based UI framework by eashish93 on Saturday April 01, 2023 @05:31AM (#35398743)
Performance is not good. Slow UI click. Tried radio and select boxes.
Re:NiceGUI – easy-to-use, Python-based UI framework by awesomebytes on Saturday April 01, 2023 @08:38AM (#35399799)
How does it compare with remi? https://github.com/rawpython/remi

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

Re:NiceGUI – easy-to-use, Python-based UI framework by winrid on Saturday April 01, 2023 @05:52PM (#35404467)
Why are the radio and checkboxes slow on my nearly $2k smartphone?