A lot of my python work involves writing simple utilities. This means either writing the tool as a command line application or using a minimal GUI.

I have been working on a simple python application recently to automate creating article stubs for this blog. I had a working version using tkinter for the user interface. I wanted to add a date picker, to allow selecting the date from a pop-up dialog. Tkinter doesn’t have a date picker in its widget collection. I did find where someone has written a date picker that is available to pip install. (It is called tkcalendar).

So, I went looking around on the web and visited PySimpleGUI’s web site. I had tried PySimpleGUI on an extremely simple utility a couple of year’s back. It looked like there has been a lot of work going on with the tool since then. So, I thought I’d give it another chance with my new app.

I am impressed. I converted my application over to use PySimpleGUI and am very pleased with the results. Here are two screen shots showing the application with both user interfaces (I have made more progress in the PySimpleGUI version, so it isn’t exactly and apples to apples comparison)

Tkinter Screenshot

Tkinter on Linux example screen shot

PySimpleGui Screenshot

PySimpleGUI on Linux example screen shot


My go-to GUI was been tkinter for several reasons.

  • It is included with python. No extra dependency to load for a simple tool.
  • It isn’t terrible to learn and you can find some OK instructions for getting started on the web.
  • It seemed like a lot of effort to learn either Qt or wxPython.
  • Qt’s licensing seemed a little scary and I didn’t want to expose my company to any kind of risk.
  • At the time I was looking into other GUIs, I couldn’t tell whether wxPython was being actively developed or if it was slowly dying. Didn’t want to put the effort into learning a tool that might not have any longevity.

Although, I’ve tried several of the themes available in tkinter but was never satisfied how they looked on linux. Clam is the best theme for linux. Themes on Windows are a little better. I know you can customize the themes, but it seemed like a lot of effort when you’re just writing a simple utility.


It’s a wrapper

OK, here’s the dirty little secret. PySimpleGUI is a wrapper around tkinter. But, it takes care of all the theming stuff to make your application look better without you having to do a bunch of extra work. So, in reality, the two screen shots about are both showing tkinter at work.

PySimpleGUI can also be a wrapper around Qt, wxPython, and Remi. I haven’t heard of Remi previously, but apparently it is a browser based UI for python apps. This means you could write your application with pySimpleGUI and have it wrap any one of four different GUI frameworks with some tweaks to your python imports! That is pretty cool.

The Layout is a list

PySimpleGUI uses python lists to define the user interface. That’s a great idea for a couple of reasons.

Here’s a simple example from their website.

layout = [  [sg.Text('Some text on Row 1')],
            [sg.Text('Enter something on Row 2'), sg.InputText()],
            [sg.OK(), sg.Cancel()]]
  • Since your lists could end up highly nested, you can define different parts of the UI in individual lists and then combine them later.
  • Since the layout is all done with lists, that means you could define dynamic user interfaces that change based on data or other factors.

It uses a loop to manage flow

PySimpleGUI uses a while True loop to manage program flow. That’s a beginner friendly concept and is easier to grasp than figuring out “call-backs” or “signals” that the other UIs use to manage their events.

This is my new UI

I think I’ll be writing all of my utilities with PySimpleGUI from now on. I’m very impressed.

You can find their documentation at readthedocs. There is a LOT of info there. I found myself using my browsers find on page feature a lot to search through the docs for particular information.

Their github page also has a ton of demo programs. They say a picture is better than a thousand words. Well, in coding, one good example is better than a ton of docs.

I hope this inspires you to take a look at PySimpleGUI and give it a try.