0

There are several Python packages that can be used to generate a user interface for a script and it's hard for me to judge ahead of time which one I should learn first. I don't have a developer-level of skill so I'm pretty slow. So instead of just trying them all I thought I'd ask here to avoid going down a path that turns out to be a dead-end for me.

Here are some examples I've run across; I've seen wxPython mentioned frequently so right now I am thinking of starting with it.

  • wxPython
  • PySimpleGUI
  • matplotlib.widgets
  • PyQt
  • pyside
  • pyGKT (seen in this answer)

What I'm doing/what I need:

I don't need something that generates an attractive or professional look. I just need an easy-to script "control panel" generator that can update itself with when add new group is clicked.

As I update/revise the script on my MacOS laptop in an anaconda installation there should be at least a reasonable expectation for it to continue to work on a Windows anaconda installation.

I'm familliar with MatPlotLib for data plotting and images. I am guessing if I use a new control panel generator I will have to learn a new data plotter unless I can easily embed matplotlib plots within the display somehow.

Each data folder has a group of images. When I run this Python script I need to browse my computer and point to a folder and several images will appear in windows. I will have a few dozen sliders and radio buttons arranged in clusters. Touching any of them triggers recalculation.

Right now there are four groups shown, there'll be an add new group button and each time clicked it triggers a pull-down menu of options and then generates a new group of sliders and buttons, up to perhaps a dozen.

In the future, I might look into a way to make those hidden but for right now we need "the big picture". So there can be blank spaces for each of the first dozen, or they could be grayed out until activated. I like the blank space option because it reduces visual clutter.

Needs to work easily with a Python 3 Anaconda installation, and (ideally but not necessarily) compatible with eventual conversion to an executable for Windows and MacOS.


Here is an ugly and edited screenshot of what I've built with Matplotlib's widgets.

ugly and edited screenshot of what I've built with Matplotlib

1 Answer 1

1

I am a big fan of, (and minor contributor to), wxPython so will obviously suggest taking a look at it. A very quick way to do so, (assuming that you are on a recent Python 3):

# Create and activate a virtual environment
python -mvenv testwx
# On windows add .bat at the end of the line below
testwx\Scripts\activate
# install wxPython
pip install wxPython
# Download, install and run the demo (later runs will just run)
wxdemo

This will install (into a venv) wxPython and download the demo which allows you to see the variety of things that is offered and the source code for them, (you can even modify the demos from within the demo and try them).

One often overlooked point in wxPythons favour is the licence is much simpler and allows run time distribution - some of the others don't.

The other option that I would suggest you look at is Jupyter Notebooks.

Disclaimer: I am the original author of the wxdemo command.


As far as a

...self-configuring simulator control panel (where) there'll be an add new group button and each time clicked it triggers a pull-down menu of options and then generates a new group of sliders and buttons, up to perhaps a dozen.

The short answer is yes— you can either add a floating panel with sliders & buttons in response to a button press or you can add them into a flexi grid sizer. Obviously the code will need to know, be told or ask what at associate the buttons and sliders with. The other trick that is often used is to create your maximum set of sliders & buttons (and associate the actions with them) and hide all the ones that you don't need.

2
  • The short answer is yes.- you can either add a floating panel with sliders & buttons in response to a button press or you can add them into a flexi grid sizer. Obviously the code will need to know, be told or ask what at associate the buttons and sliders with. The other trick that is often used is to create your maximum set of sliders & buttons (and associate the actions with them) and hide all the ones that you don't need. Apr 2, 2020 at 15:46
  • Okay; I've moved that information back into the answer. Once the edits are approved (as is or modified) I can click accept. Thanks!
    – uhoh
    Apr 2, 2020 at 23:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.