
Show HN: Eel – a simple Python library for making little HTML GUI applications - ChrisKnott
https://github.com/ChrisKnott/Eel?
======
ChrisKnott
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.

~~~
meredydd
This 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)).

~~~
mlevental
cool except it's not self-hostable/oss. why would you use a hosted frontend
for a local app?

~~~
meredydd
It 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.

------
zserge
A similar project, but for C/C++/Go (using gtk-webkit, cocoa-webkit and
mshtml):

[https://github.com/zserge/webview](https://github.com/zserge/webview)

Does not require a web server (uses JS-to-native bindings instead), which
might be a benefit.

~~~
kodablah
An older PoC that someone did in Go very similar to how this project fires up
an already-installed browser: [https://github.com/utamaro/neje-
ui](https://github.com/utamaro/neje-ui)

------
goostavos
Shameless plug! I have a similar Python project but focused on building native
applications without actually writing a single line of UI code. I call it
Gooey[1]! It was front page on HN a few years ago ^_^

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](https://github.com/chriskiehl/Gooey).
[2] [https://user-
images.githubusercontent.com/1408720/34464824-c...](https://user-
images.githubusercontent.com/1408720/34464824-c044d57a-ee46-11e7-9c35-6e701a7c579a.png)
[3]
[https://github.com/chriskiehl/Gooey/tree/rc1](https://github.com/chriskiehl/Gooey/tree/rc1)

~~~
hardmath123
Neat! It would be cool to port this to one of the node option-parsing
libraries, perhaps launching a small Electron-ish webapp for the "gooey."

~~~
goostavos
My ultimate goal is to get rid of the need for language specific ports -- one
front-end to rule them all! :)

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

------
marczellm
For my similar purposes I made this:

[https://github.com/marczellm/tkpf](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.

~~~
jitl
The tk native widgets don’t look good, because they don’t follow the OS’s user
interface conventions. The most notable issue is that widgets don’t have the
correct padding or font, even if they’re being rendered via Cocoa (for
example).

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...](https://user-
images.githubusercontent.com/6771275/28181423-d9c4bfd4-6808-11e7-955a-c0e18219e609.PNG)

------
kofejnik
I found Remi
[https://github.com/dddomodossola/remi](https://github.com/dddomodossola/remi)
to be excellent for creating HTML frontends to python apps

~~~
zoom6628
Thanks for pointing out remi which i just gave a test-drive. Also very nice!

------
mch82
Great to see efforts like this trying to move the needle on the designer
usability of “native” UI toolkits for Python/Go/Ruby/etc.

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.

~~~
pavlov
Qt is a great choice for embedded Linux UIs.

------
nzjrs
Remi
([https://github.com/dddomodossola/remi](https://github.com/dddomodossola/remi))
is also similar and is shipping in a few commercial products and a few popular
raspberry pi apps

------
Mister_Snuggles
Wow, that’s pretty cool! I can think of some interesting uses for this!

------
shivaprasad
I had built a similar one using WebKit + Gtk.. Did not actually know about
`--app` option to Chrome. This would have been a good fallback option when Gtk
+ WebKit is not available..

[https://github.com/shivylp/visualpy](https://github.com/shivylp/visualpy)

------
lifeformed
What's the performance like, compared to Electron?

~~~
anaphylactic
Runtime performance will obviously vary across platforms, but in all cases, at
least the executable will be much, much smaller! :)

------
pwaai
curious why you didn't choose asyncio? If I understand this correctly, it lets
you write python endpoints to call from javascript? Does it let you create UI
from python only?

Lot of questions because I'd like to see more Python use in front-end/electron
type of projects.

~~~
dna_polymerase
You do not understand this correctly:

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

~~~
pwaai
I still don't, what does that mean exactly?

~~~
wingerlang
> If I understand this correctly, it lets you write python endpoints to call
> from javascript? Does it let you create UI from python only?

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.

