News for hackers. Stuff that matters.

rodja

Re:NiceGUI – easy-to-use, Python-based UI framework 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 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 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!

NiceGUI 1.2 – Bringing Electron-like Capabilities to Python with pywebview

We are thrilled to introduce NiceGUI 1.2, a major update to our open-source Python library (https://nicegui.io). With an emphasis on simplicity and ease of use, NiceGUI empowers Python developers to create user-friendly graphical web-based interfaces while focusing on their Python code. The library has been well-received, boasting 3000+ stars on GitHub and a growing community.Lately we've...

( Read More... | 1 comment | on HN )
I summarized my thoughts on this about two month ago on Reddit (https://www.reddit.com/r/Python/comments/10h6l7e/comment/j5x...). Here the recap:

- NiceGUI was initially build for accessing and controlling hardware as shown in our webcam demo); I'm not sure how it would be done with Pynecone

- NiceGUI encourages the use of standard Python (callbacks, if-statements,..), Pynecone on the other hand uses explicit State classes and provides constructs like pc.cond and pc.foreach.

- NiceGUI uses Vue/Quasar for the frontend while Pynecone is build on NextJS

- NiceGUI generates HTML/JS/CSS via templates on the fly while Pynceone has an explicit compile step; so NiceGUI can be run with normal "Python" instead of using a command like "pc"

- while both frameworks use FastAPI for the backend, in NiceGUI you can actually use your own App and simply extend it with NiceGUI to provide additional UI; Pynecone hides FastAPI which makes it harder to provide other API endpoints (for example to serve images from memory instead of files).