Show HN: Eel – a simple Python library for making little HTML GUI applications
github.com
github.com
I thought others might find it useful in situations where it isn't worth the investment of using a real GUI framework.
Tested (a bit) on Python3 on Windows/Mac/Linux.
Interested in any feedback at all, or any existing projects which are similar.
[0] https://github.com/wooey/Wooey [1] https://github.com/chriskiehl/Gooey
Simple, functional cross-platform GUIs with Python and Tk is a very nice thing.
If we talking cross-platform production ready, pretty GUIs, probably Python is not the best choice or if we insist on Python, then in pair with something like Qt
For simple GUIs it's easy to use and the code is clean and extendable. There is a canvas object for arbitrary graphics or custom widgets, but without OpenGL support they look ugly and it's not performant. The existing widgets are the basic, so no high-level stuff like date-pickers.
As for the layout "language", there are 3 layout managers that CSS has only begun to reach feature parity: - "pack" which is like flexbox - "grid" which is like CSS Grid - "place" which is like absolutely positioned elements All this can be mixed and matched.
With a couple hundred lines of Python you can do a React-like and bind tightly the entire GUI state to a complex `dict` that can be serialized to JSON in a couple of lines. Don't discount Tk just yet.
Why would you want to serialize it to JSON? To send it to a server or something like that?
With the correct widget types, the business state IS the GUI state and can be treated the same. For simple GUIs, there will be no redundancies and no undefined states.
Interesting, and makes sense. Coincidentally, just today I was remembering the feature of the Palm IV or V that I used to have (also the Palm Zire later, but don't remember if the latter also had the feature), of saving app state, so that when you turn it on again, all apps would be running (or was it only single-app-at-a-time, don't remember) with their exact state preserved from when you shut it down, down to even the last characters entered in the middle of a field in a form that you were filling in, for example. Also it was an almost instant-on kind of device. And was wishing that my PC / laptop could be that way too. I had read a while ago that some work had been done on much faster booting times for Linux or other OS-based PCs. Don't know the current status of such efforts.
One similar project is https://anvil.works. It's got a pure Python front end rather than HTML/CSS/JS, with a drag-and-drop designer - kinda like a modern Delphi or VB. But the client-to-server function call interface is very similar (are you using websockets too? [edit: Yes you are!]).
It's targeted at traditional web apps, rather than desktop apps, but it has an "uplink" that lets you connect local code (eg here's me building a GUI that shows text on a Raspberry Pi: https://anvil.works/blog/uplink).
Anvil isn't for distributable desktop apps (that's not where most of the action is these days, for better or worse). But we use it for one-offs (driving local code via the Uplink) all the time.
Prototype your code in the notebook ..and then click a single button to export it as a standalone app/API.
People will pay for this !
I'm personally not a fan of the "bundle a browser every time" model of Electron but you could maybe do that as well to be completely self contained.
As I mentioned in the README, I think the main use of the library is either prototyping, or internal tools for your own (or your team's) use.
https://github.com/zserge/webview
Does not require a web server (uses JS-to-native bindings instead), which might be a benefit.
The next version is currently in RC1 and brings support for in-UI validation/error messages, better layout customization[2], new widget types, and more!
I'm trying to recruit a few more people to test the current release branch[3] :)
[1] https://github.com/chriskiehl/Gooey. [2] https://user-images.githubusercontent.com/1408720/34464824-c... [3] https://github.com/chriskiehl/Gooey/tree/rc1
The whole thing is currently powered by plain ol' json. The next step on my list is (optionally) shipping an executable that any language can feed the appropriate JSON to in order to get their GUI side for 'free'.
https://github.com/marczellm/tkpf
It's a declarative way to do simple Tk GUIs. Also, Tk does not have to look like 1997, it's themable and it can also use the native widget library on Windows and OS X.
I should probably take a look at it again if it can now do native components. I'm really sick of these bloated new desktop frameworks like Electron.
The example layout here [0] may be functional, and rendered by the platform, but it does not look “native” because the text areas are shoved right up against each other.
[0] https://user-images.githubusercontent.com/6771275/28181423-d...
Any ideas for other ways designers can help improve/influence the UX of “native” toolkits?
It seems like native UI development (especially for PC or Linux embedded device displays) is stuck years behind the simplicity of layout for the web. And I’m not aware of anyone but Apple doing constraint-based layout (as with Interface Builder). With platforms like Raspberry Pi and BeagleBone increasing the accessibility of embedded Linux design it seems like there’s a need for designer-friendly UI toolkits that don’t require tons of dependencies or the complexity of running a web stack to render a UI, but do require responsiveness across devices and operating systems.
Lot of questions because I'd like to see more Python use in front-end/electron type of projects.
> [Asyncio] provides infrastructure for writing single-threaded concurrent code using coroutines, multiplexing I/O access over sockets and other resources, running network clients and servers, and other related primitives.
It does not let you write endpoints.
It does not let you make UIs.
All asyncio does it to let you run python code asynchronously.