5 ms·
I made this Python library for my own needs because I wanted to make some very simple (30 line) GUI applications using HTML/JS for the frontend. I thought othe
by ChrisKnott 9y ago
I made this Python library for my own needs because I wanted to make some very simple (30 line) GUI applications using HTML/JS for the frontend.
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.
- zoom6628 9y agoIt looks great. I have been using bottle for simple web application. While there appears to be overlap between the too this looks excellent way to built good quality client apps using browser UI but without the 'ajax-tax' of Electron and its ilk. Looking forward to trying this on some local client apps i have to do in next couple of days.
- zitterbewegung 9y agoCould you create a web accessable version of this where you give someone a link and they would have the same access? I like this because I really don't like dropping into javascript in a codebase that already has a bunch of python code.
- goostavos 9y agoYou may want to check out a project called Wooey. It's a drop-in-and-go frontend for your scripts kind of like Gooey[1], but web rather than native focused. [0] https://github.com/wooey/Wooey https://github.com/wooey/Wooey [1] https://github.com/chriskiehl/Gooey https://github.com/chriskiehl/Gooey
- trymas 9y agoI do not want to sound in a bad way, though if you need to create very simple GUIs with Python, what's wrong with Tk?
- tasty_freeze 9y agoI'm out of the loop, but I have never seen a Tk interface that didn't look straight out of 1997. Also, many people are "fluent" in HTML/javascript/python, but aren't so familiar with Tk.
- istjohn 9y agoAlso, there are a lot of great libraries (e.g., for visualizations) in JS that this would allow you to use.
- trymas 9y agoYes, I know that, though if I'd want a simple GUI in few lines of python probably it's something not client facing and internal use only, thus design aspect is not bothering me. 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
- JetSpiegel 9y agoThemed TK uses native widgets and it presents the same basic API. It's distributed by default too, it's not an external library. You can use both the old and the new widgets in the same GUI. 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.
- vram22 9y ago>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?
- meredydd 9y agoThis is neat! One similar project is https://anvil.works 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 https://anvil.works/blog/uplink).
- sandGorgon 9y agoThis is just one step away from being a better Jupyter. 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 !
- mlevental 9y agocool except it's not self-hostable/oss. why would you use a hosted frontend for a local app?
- make3 9y agofrom their perspective, to charge people, I guess
- meredydd 9y agoIt actually is self hostable (that's how quite a few of our customers use it), but no, it's not OSS (because we needed to build a sustainable business). 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.
- ChrisKnott 9y agoAnvil has been on my to-check-out list for a while, I think it's really impressive what you guys have done.
- bmelton 9y agoI don't see it mentioned in the README, but is this something I can package into a distributable package?
- ChrisKnott 9y agoI'm not sure to be honest, I think it would probably work - you could just bundle all the dependencies (apart from the browser) using 'pip download eel' - that seems to be about 750KB of stuff. 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.
- voltagex_ 9y agotoga - sort of.