Hacker News new | past | comments | ask | show | jobs | submit login
Python GUIs for Humans – Transforms UI into People-Friendly Pythonic Interfaces (github.com/pysimplegui)
275 points by dragonsh 35 days ago | hide | past | favorite | 43 comments

For those looking to build a simple GUI, another option is Gooey [0]. It takes your arparse declarations and builds a simple GUI based on that.

Gooey is probably easier to set up, but PySimpleGUI looks like it's more flexible and powerful. Look at your own battle and choose your weapons accordingly :-)

[0] https://github.com/chriskiehl/Gooey

Came here to mention this, Gooey is very useful to make simple command-line scripts "non-tech-friendly" by giving it a familiar GUI rather than a scary black terminal window :)

Kudos to the writer! I used this framework for an small robotics project and, as others pointed out, I was up and running in less than an hour. However, as the project grew more complex, I reached a point where I felt the framework was in the way: I wanted complex things, and lacked the means to configure the framework that precisely. I would recommend others to keep the framework for what it does so incredibly well : small / prototypes projects ; but do not hesitate to switch to a more powerful backend once you feel your needs are complexifying.

What solution did you end up switching to?

I have a feeling that most python GUIs are lacking in some area and for full creative freedom someone would have to go for flask or fastapi, build the UI with modern js-frontend frameworks and connect that frontend with the actual application using websockets or regular HTTP-Requests.

I’ve had great success using PyQt for quite sophisticated GUIs. Any of the native bindings should give good results too. I doubt JS would give you more flexibility and performance than these.

I have found DearPyGui [1] to be a really efficient way to knock up a quick GUI for a Python script/app. There's almost no boilerplate and I've found it scales reasonably well as things get more complex as it's easy to split views/"components" into modules and classes.

[1] https://github.com/hoffstadt/DearPyGui

I've been very happy with using Qt and PySide and now PySide2.

Without it I couldn't have produced Captain's Log, for example : https://captainslog.scarygliders.net/captains-log-2/

This is exactly what happened with my home dashboard.

The initial version, 5 or so years ago (maybe a bit more, I do not remember) was based on a python library (sorry, I forgot the name but it was the major one at the time). It worked fine for a bit but moving to a kiosk browser and vue.js completely changed the game.

The backend was Python, then got replaced by a bus (mqtt) updated via golang microservices (they were in python initially, but then I wanted to learn go)

For most applications in my company, we prefer fastapi + Jinja to generate HTML pages, and rely on the browser to display that for us. For the few programs that need to be run locally & without browser, we use PySide2 (Qt bindings): the framework is bulkier, but somehow feels more reliable.

This is an incredible project I had never even heard of before. This is what github/lab projects should be in my opinion. An incredible solution, well documented, with exceptional examples. I got the intent and was up and running in less than an hour. Great functionality as well in terms of simplifying layout and portability.

Very very neat.

I might use this the next time I need to build out a small personal project. I've taken a rather strong liking to Python recently. So much is built into the standard library compared to NodeJS. Very useful for quick projects/ AWS lambdas where installing dependencies is a pain.

Do you have a good guide on wrapping this in a binary ?

Wouldn't be able to use it in a corporate environment though, the licensing isn't great for that.

I like the concept a lot, having written my own "wrapper" for Tkinter and wishing I could adapt it to Remi. My only thought is that defining the contents of a layout as a dict instead of a list, would allow the elements to be referenced by a name rather than number. That would make it easier to read and modify one's own code.

From Example 2 (https://github.com/PySimpleGUI/PySimpleGUI#example-2---inter... ) it looks like you can assign names to layout elements with "key".

Dict() is unordered.

As of Python 3.6, Dictionaries are ordered.

It's actually as of Python (the language) 3.7. The CPython implementation of Python 3.6 already has ordered dicts as an implementation detail, but it's not part of the language in that version.

Uh, nice, didn't know. That will fix a lot of bad (nondeterministic) code out there :)

Does this kind of app distribute easily? As in, can I package up the runtime and the app into a single exe? I see this, but does someone have experience to share?

Edit: Found it!


Another option to look into is Nuitka. I haven't tested it with PySimpleGUI, but I've used it to package wxPython apps for windows in the past and it worked really well.

I suppose if targeting the web backend you could package into a docker container. I wonder if golang embed could be an option for packing python for native ui

Does anyone know how this compares to guietta? [1] Both look quite similar, and I have already successfully used the latter in two small projects. It was so easy to set up, I had not even have to read much of the documentation at all.

Edit: I have found the answer in the docs [2]

[1] https://github.com/alfiopuglisi/guietta/ [2] https://guietta.readthedocs.io/en/latest/intro.html#aren-t-y...

Used Guietta for a small project. Looked simpler to code and to "package". Nice you mention it.

I used PySimpleGUI in a devops app that used the new tables widget (only on tkinter) to track/resolve/debug issues (i.e. domain specific sentry). It worked really well! The whole codebase was 300 loc: pull issues from api, put them into table rows, filter rows by combobox filters and handle button presses.

Unfortunately as the app grew the main loop became really hard to follow and I've started to miss callbacks or some sort of oop wrapper around the whole thing. I also noticed that any other backend than TKinter was more like a 3rd class citizen rather than an alternative. Other than that it's probably the best GUI programming entrypoint in Python!

I can't help but love projects like this. I used to write simple apps that took a simple input and did a thing... and it seems so unintuitive compared to VisualBasic, for instance, even allowing for defining windows programmatically.

Just finished up a Python class as part of my EE this summer. I had no idea this wasn't the default way everyone did Python GUIs. This was the main library we used throughout - it was very approachable and easy to configure.

I've also found this project to be very good. I used it for a personal project to help me manually tag images and prepare a payload to upload to a remote server's database.

Some of their naming conventions though are odd IMO but otherwise I thought it was an easier way to process images than a webapp which is my usual working area. Now that I think of it though, a juniper notebook may have also been a solution but I wanted to dabble with writing a GUI.

Is there something like this but creates a simple web app?

Anvil (https://anvil.works/) is probably the closest thing to what you are looking for, at least in the python world.

To make it run entirely in the user's browser, you need to have the Python interpreter and any additional libraries running on the user's machine. This is the case with Javascript but not Python.

This actually has a web backend.

I wrote a pretty fancy GUI for a real-time system (was handled by MPUs externally, so no real-time in GUI). I found it to be fairly easy to use; there are plenty of examples, and often you can mix-and-match from the examples to get what you want.

It's also true that as you want fancier interactions, you have to be clever to get the framework to do what you want. It's very good --- best easy-to-use Python GUI I'd say --- but it won't handle every fancy GUI requirement. (That's why you have PyQt etc)

Props for the best readme I've seen on GH in a long, long time.

Interesting. PythonCard used to be a very handy tool, built on top of wxPython, but it was abandoned some years ago.

One question. Which is the best python library for TUI?

I used to use http://urwid.org/ but It needs a lot of code to do the stuffs.

I look for a library that is packaged in Debian (if something is in Debian, it is standard and has long life).

I've used pysimplegui at work it is a great framework to get up and working for a simple gui. It took me 30 minutes to code the gui and I sent it to our underwriting department to help them deal with a bug we were having with our system.

I’ve used this to build stuff of various complexity and it works well. The docs are good.

I've used this library twice, it is fantastic when you need a simple GUI on top of a Python script. Congrats for being on the front page of HN!

I really like the "interface layout as a list of lists" idea. It's kind of like a LISP 'code is data' paradigm but for guis

The code looks readable. This needs to be exposed, it's quite easy, and it seems interactive.

The example code almost looks like HTML ...

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact