Python GUI library experiences

Splitting off from PySimpleGUI now requires a (paid) license. Opinions? because I want this to be a positive and general discussion without getting bogged down in “PySimpleGUI did nothing wrong” vs “PySimpleGUI is evil” discussions that are likely inevitable.

What GUI libraries for Python do people have personal experience with? What are the advantages and disadvantages? I’ll start off, but I don’t have experience with many.

  • Tkinter has the rather huge advantage of being part of the stdlib, but it’s a bit clunky. Never really enjoyed working with it but it has its place.
  • PyGObject (GTK) is quite decent. Tends towards the verbose at times but that might be fixed with a simple wrapper. Overall been fairly happy withi t.

That’s literally all I’ve used (not counting older GTK-based things that have now been deprecated in favour of PyGObject). Which others do people know?

4 Likes

I have use wxPython in the past but now use PyQt for all my GUI apps.

PyQt provides a powerful framework that works across X11, Wayland, Windows and macOS well.

I like that its good OO design and has great support from the maintainer and PyQt community.

My two public projects are https://www.barrys-emacs.org/ and https://scm-workbench.barrys-emacs.org/

You’ve inspired me to look back at the first Python code I ever wrote 13 years ago, back when Python 2 was a reasonable choice. I made heavy use of:

matplotlib.widgets

As a curve ball, I was recently delighted to run pure Python packages in Pyodide in a web browser. So, if I needed a desktop app these days I’d use Tauri, and running Python on a side car. Embedding External Binaries | Tauri Apps

My (few and crude) Python GUI interfaces I use tkinter. It’s in the
stdlib and works on multiple platforms. It is simple. You can roll your
own widgets built on top of it. (I saw
TkInterMapView
just yesterday, amazing.)

I tried PySimpleGUI a few years because as with HTML, I hate layout. It
had some nice stuff. But (as of a few years ago) it had the following
downsides:

  • the various backends were independently maintained parallel
    implementations of the widget set with no common inherited ABC classes
    to keep them sane and synced - some widgets had different APIs
    depending on the backend
  • I couldn’t do dynamic stuff (insert/remove widgets on the fly) - it
    suits only fixed layouts. I was writing a Tagger GUI to help me manage
    files, and needed to render eg file tags in a sidebar etc. Simply
    impossible in PySimpleGUI.

I used PyQt5, 6, PySide, PySide2, all layers on the Qt widget set. I did
not enjoy it. Qt has the advantages cites elsewhere: like Tk, works on
several platforms, and does have a lot of solid widgets. But:

  • I found myself lost in a sea of Python libraries: which to use? PyQt
    or PySide? The 5/6 is basicly Qt 5 vs Qt 6, so that’s ok.
  • ill discipline in widget use (my naive fiddle a widget from another
    thread, always wrong) actually caused a segfault at some point
    (presumably races inside the C/C++ side of things)
  • I was trying to built a standalone app for a client with this using
    py2applet, and getting the libraries includes was a nightmare; i never
    really figured it out, but it basicly meant even when I had it working
    the app couldn’t just be copied to another Mac and just work.
    I know it’s possible to bind everything in an app, that’s one of the
    cool things about them, but never got it working well.

So for my needs, I use tkinter.

I an not a front end developer and the experiences above reflect that.

1 Like

I have been packaging PyQt 5/6 for linux, macOS and Windows for many years at this point and simple, native, install.

On macOS generate a .app that is on a .dmg that allows drag to /Applications folder.

On windows create a setup.exe and Inno setup.

In both cases all the scripts used are published.

Care to provide a link? I was making .apps and they were always fragile.

See my barrys’s emacs code here BarrysEmacs/Builder at master · barry-scott/BarrysEmacs · GitHub its a set of bash and python code.
Start with build-macosx.sh and build-windows.cmd, that are also a set of build-for-XXX.sh for linux distro.

The same pattern is implemented for GitHub - barry-scott/scm-workbench: SCM Workbench is a GUI to easily work with Git Mercurial (hg) and Subversion (svn) repositories in the style of PySVN WorkBench

Suggest you start a new topic to discuss the details if needed.

1 Like