Creating Python GUIs With GIMP

GUI design can be a tedious job, requiring the use of specialist design tools and finding a suitable library that fits your use case. If you’re looking for a lightweight solution, though, you might consider just using a simple image editor with a nifty Python library that [Manish Kathuria] whipped up.

[Manish’s] intention was to create a better-looking user interface solution for Python apps that was also accessible. He’d previously considered other Python GUI options to be unimpressive, requiring a lot of code and delivering undesirable results. His solution enables the use of just about any graphic you can think of as a UI object, creating all kinds of visually-appealing possibilities. He also was eager to make sure his solution would work with irregular-shaped buttons, sliders, and other controls—a limitation popular libraries like Tkinter never quite got around.

The system simply works by using layered image files to create interactive interfaces, with a minimum of code required to define the parameters and performance of the interface. You’re not strictly limited to using the GIMP image editor, either; some of the examples use MS Paint instead. Files are on Github for those eager to try the library for themselves.

We’ve featured some neat GUI tools before, too, like this library for embedded environments. Video after the break.

28 thoughts on “Creating Python GUIs With GIMP

  1. “a better-looking user interface solution for Python apps that was also accessible.”

    I assume that was meant in the sense of “accessible to vibe coders who think learning a programming language sounds, like, really hard, man.

    Because, the LAST thing you can call an interface assembled out of image layers is “accessible”, in the more correct sense of, “Can be accessed by people with disabilities and other special needs.”

    When we got rid of Flash, a whole category of awful “pretty-picture” visual interfaces met it’s all-too-timely demise along with it. Leave it to this project to bring them roaring back. 🤮

    1. I’m sure there’s ways to work around the disability aspect…

      Honestly, any project that makes creating sleek, modern UIs easier without Electron bloat is nice. (Although I don’t know how big apps built with this are)

      Also not all coders who are looking for simplicity are vibe coders…

      1. If the interface is bitmap-based? It’s a LOT bigger than one created by drawing primitives on the screen. AND it can’t fit itself to the vast range of device screens apps need to run on these days. So either you have to create, and include, N different sized copies of each bitmap, or you have to deal with the ugliness of bitmap scaling. Ditto i18n, if there’s any text in the bitmaps.

    2. I take it you’ve never used, or even seen, a key generator. They typically use C++ to draw bitmaps over the form in order to pretty it up. So, a bunch of warez sceners and the like would disagree with you. :)

    3. “an interface assembled out of image layers” is literally how the Windows and Apple UIs work.

      Not saying you’re wrong, just saying that “real” programmers have been doing it this way for about 20 years before “vibe coders” were a thing for you to rant about instead of contributing meaningful discussion.

    4. I was actually sad for flashes demise, all those cool little nifty indie games gone in an instant. Yes, you can rewrite them in HTML5+JS and there are projects to collect them all and bring them back, but for the moment they where all gone. Newgrounds was a wasteland.

  2. I can see the use case. That said personally I am not one of those people that needs a gui. All my python tools tend to have cli menus and prompts because they are simple, they work, and ultimately the goal is the end result

    1. I am in the same boat for personal projects but sometimes you need to make a UI for not so CLI oriented users. My GF wanted a label printer that would take a few details and spit out a uniform label, a CLI interface was not going to be an option, some people need clickable buttons and dropdown menus.

      1. Same, I’d stick with CLI if it wasn’t for the occasional need to add a basic GUI for someone else. I’ve found pygubu-designer is good for quickly putting something simple together and exporting the boilerplate tkinter code. It has a few foibles, but it’s definitley easier than writing it all out myself and way less buggy than trying to palm it off to an LLM.

    1. I second that. HTML maps are STILL included in all flavors so far, it is a matter of finding and using them (wisely). Maybe a bit of a JS code (not TOO much – no Bootstraps, etc), but that’s about all that’s needed (JS can and regularly do handle things like asynch calls when/if needed, so there).

  3. ahaha i was gonna complain that there’s no write up but i found the github and the README.md on the github is ..drumroll.. 5 links to youtube videos! that takes the cake. i’m genuinely impressed.

    i want to know what this is. because i’m always trying different pidgin GUI approaches. and, like Paul said, it smells like an HTML imagemap from the mid 90s. so i looked at the code. and this is not the code! it’s just a set of demos using the library, but i can’t find the library. under GIMPyWidgetUI, there is only one repository: GIMPyWidgetUI-Demo. from the demos, i can’t really tell how imagemap-y it is…like, does it have a layout engine at all?

    but i can tell one thing. this is not an alternative to tkinter, it’s just a wrapper for tkinter / collection of widgets for tkinter to do the last thing i’d ever want to do with it.

    anyways, in my own life, i like GTK alright (though it’s verbose, and i don’t appreciate the moving target). and the Android XML gui description is alright (also verbose, and a moving target). honestly i thought java AWT was a high point 25 years ago…less verbose than GTK and i didn’t use it long enough for the target to move under my feet. really for end-user UI these days, my favorite is HTML+CSS, which is finally (as of 2015ish) powerful enough for pretty much everything i ever ask of it!

    but for my own apps i keep using SDL and just rendering everything at a pretty low level. i don’t actually like clicking on icons using the mouse (it’s alright on a phone screen), even when i’m genuinely making a GUI. sometimes SDL feels like a moving target but at least all of its incarnations have been simple to use as a cross-platform framebuffer. but lately i have taken it a step further, i have been using libX11 without SDL in the middle. and that’s a lot more convenient than i thought it would be, given the lore i’d heard about it in the 1990s! most lately, i’ve switched to libxcb and i’m not really convinced the improvements matter to me but it’s definitely more well-thought-out in its basic idioms for interacting with the protocol.

    so yeah most my GUIs look like an oscilloscope display…a graphical display of whatever the user is working on, some status bars at margins of the display. maybe a row of soft buttons. it’s the only way to fly :)

    1. You may want to give IUP a try.
      [https://www.tecgraf.puc-rio.br/iup/]
      It’s a multi-platform toolkit that uses native interface elements and have a simple API.
      Also, it has optionally it’s own description format (LED) which I find simple and clear.

  4. Hi Lewin,

    Thanks for writing this article on my work.

    I can see some words of appreciation and some criticism.

    In general, I believe people who have left some “not very thoughtful” comments are either ignorant or are still catching up with the concept of:
    1. Rapid Prototyping
    2. Rapid Application Development
    3. Separating code and user interface
    4. Work smart not hard…

    Anyway, this work is ~10 months old and was an outcome of an urgent prototype that I was working on that required radio buttons that were shaped like a pizza slice (4 quadrants on a circle, as is demonstrated in one of the YouTube video here https://youtu.be/TdpWYo3-Y6Y?si=S_YJv-LMNmf2GKEP). Took me around 7 hours to work it out. The real challenge was only a mouse click within the irregular shape should change the selection so a rectangular image on a label etc wasn’t a solution.

    It is in fact a wrapper and inherits from tkinter but the work has enabled some features that is offered by kivy. I am currently working on kivy wrappers to cover mobile platforms as well (out by end of November).

    I work with graphics designer for UI design so that I only worry about the code. Simulators, mimics, prototypes etc, is a matter of hours for me now (… Minutes where I want to give a new look to some of my old UI’s where I have already got my functions defined and tested).

    I work with fixed size window applications (essentially Linux based SBC’s with fixed sized LCD screens) so I haven’t extended my work to cope with different size screens for the same executable. There is quite a lot of work involved in that. I have instead switched my focus on kivy
    and BeeWare so I might do something about it in future.

    Thanks once again to those who have checked GitHub demos.

    Regards,

    Manish Kathuria

    1. Always looking for better ways to do things, neat deployment even if the comments are at times critical. Pay them no mind.

      What software are you using for development in your videos? I’ve been writing in Notepad ++ for so long but look for a better compiler/interface when I can. I’d like to try it. Thanks.

    2. Agree that while the “expert” programmer commenters here often know their stuff, what they seem to lack is the ability to relate to other people and have compassion for those who may not have lived their exact lives and thus have different needs related to programming. Thanks for posting. I enjoyed reading about your work.

  5. Hi Lewin,

    Thanks for writing this article on my work.

    I can see some words of appreciation and some criticism.

    In general, I believe people who have left some “not very thoughtful” comments are either ignorant or are still catching up with the concept of:
    1. Rapid Prototyping
    2. Rapid Application Development
    3. Separating code and user interface
    4. Work smart not hard…

    Anyway, this work is ~10 months old and was an outcome of an urgent prototype that I was working on that required radio buttons that were shaped like a pizza slice (4 quadrants on a circle, as is demonstrated in one of the YouTube video here https://youtu.be/TdpWYo3-Y6Y?si=S_YJv-LMNmf2GKEP). Took me around 7 hours to work it out. The real challenge was only a mouse click within the irregular shape should change the selection so a rectangular image on a label etc wasn’t a solution.

    It is in fact a wrapper and inherits from tkinter but the work has enabled some features that is offered by kivy. I am currently working on kivy wrappers to cover mobile platforms as well (out by end of November).

    I work with graphics designer for UI design so that I only worry about the code. Simulators, mimics, prototypes etc, is a matter of hours for me now (… Minutes where I want to give a new look to some of my old UI’s where I have already got my functions defined and tested).

    I work with fixed size window applications (essentially Linux based SBC’s with fixed sized LCD screens) so I haven’t extended my work to cope with different size screens for the same executable. There is quite a lot of work involved in that. I have instead switched my focus on kivy
    and BeeWare so I might do something about it in future.

    Thanks once again to those who have checked GitHub demos.

    Regards,

    Manish Kathuria

Leave a Reply to Cad the MadCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.