Products > Programming

GUI for Python?

<< < (16/17) > >>


--- Quote from: bd139 on June 13, 2022, 05:58:49 pm ---I’ve had about 15 million lines of it in production before. Not one issue. Even the python 2 to 3 port was smooth.

--- End quote ---
Good for you. Total opposite experience here.

When you report a problem on a forum related to one of the bigger python projects,
the first thing they ask you is which version exactly of python you are using.
Then they tell you to try version instead of version 3.xzy...

Nominal Animal:

--- Quote from: Karel on June 13, 2022, 07:16:11 pm ---Then they tell you to try version instead of version 3.xzy...

--- End quote ---
I've done that in C projects also, for the simple reason that if there has been a lot of churn in that part of the code base between the two versions, having information in which version the behavioural change occurred, tells a lot about what code might cause it.  Hell, this is exactly why git bisect exists: it is how bugs and behavioural changes in the Linux kernel are pinpointed.

In other words, it is an useful buggy code locating technique.  Please, do not think it is a way to just divert you to a new version!  I have never done that with the intention of having the end user switch to a newer version, only as a tool to pinpoint the source code involved!  I know what kind of hell version dependencies can be, firsthand.

Only when they refuse to fix the issue because it does not occur in a later version, does it actually become assholey behaviour.

Also, even if Python developers were to refuse to fix the issue (for example, for 3.8.x because the bug is not a security issue), Linux distribution maintainers often will, applying bug-fixing patches at the distribution level.  In general across many projects, sane upstream developers then relent, and release a bugfix anyway.

Why Python 3.8.x as an example?  It is listed as "security fix maintenance only", but 3.8.x is currently shipped in e.g Mint 20.3 (Long Term Support) and other Debian/Ubuntu derivatives.  I personally am currently using 3.8.10 myself, even though 3.10.y is the Stable and 3.11.z the Development version right now (2022-06-13).


--- Quote from: Nominal Animal on June 13, 2022, 03:36:15 pm ---It'd have to be something actually useful, as to properly "stress" the toolkits/frameworks, and see what working with the codebase and resource files is like.  I just cannot think of a suitable example.  Even better if someone designs a suitable UI in pygubu-designer/Glade/Qt Designer, or even just e.g. Inkscape as a picture, to start with.

--- End quote ---
The latter is a good option. Draw a layout as a mock-up and code it. I've let go of the idea of using GUI design tools a long time ago. You quickly want your controls & screens to scale which is easy to do in code but very hard with controls that just sit there at a fixed position. And creating a bunch of contols using a for loop is quicker too and the spacing & position can be changed much quicker compared to using a GUI design tool and adjusting the position of every button, text, etc.


--- Quote from: Nominal Animal on June 13, 2022, 06:01:39 pm ---In any case, if someone comes up with a good idea for a basic but useful GUI example program, especially if they bother to design/sketch out the UI, I do promise to try to write at least Qt (PySide2 + PyQt5) and Gtk+ (gi) implementations (on Linux, as I cannot currently test on Windows), perhaps also a tkinter/pygubu one.  (The "try" is there, because I'm still struggling with productivity/responsibility/stress management failures, and cannot promise I don't stumble on those personal pitfalls I tend to stumble on. :()

--- End quote ---

Oddly enough, I had occasion to make just such a tool a few months back. It's a 'data inspector' for signals from an ultrasound system whose purpose it is inconvenient to go into too deeply here. Suffice it to say, the development engineers were having a hard time using the application software, which does some fancy signal processing and presents measurements derived from this processing, to decide if the system was actually working as designed or not.

So I put something together in Python (since rest of the software is in Python) using PyQt5, numpy, scipy & matplotlib. It shows a tabbed interface that lets you look at a signal in the time domain or as a spectrogram, or a whole set of such signals together as an echogram (i.e. like a medical ultrasound image). With features like optional harmonic cursors in the spectrogram, time/frequency/range cursor readout in lots of different modes, and lots of control over the visualisations to bring out different features (or bugs). It's been highly revealing. Also handy to make pretty pictures to show the investors!

I started using the Qt visual designer, but in the end I kept it only for the menu structure. The rest of the interface I just wrote by hand in Python. It uses the 'springs and struts' approach which I am familiar with from ancient history. This leads to a huge __init__() method for the View object, which is inconvenient to work with. It's also a bit hairy keeping track of the slot/signal connections, since that can only really be done by the Controller. You end up having to modify two separate parts of the code for each change or addition to the UI. It's not the old VB click & code approach. But the View & Controller are both really too large & unwieldy for comfort and should be split up somehow. I didn't really try, but Qt doesn't seem to offer any help with that.

One unexpected nice feature was PyQt's threading support. It made keeping the interface live while loading data from a directory containing some hundreds of CSV files quite easy to accomplish. Complete with progress bar and cancel button!

Now we are gaining confidence in the system, the inspector is seeing less use, but it still scratches a significant itch. No thoughts of reworking it using another GUI toolkit though, and I can't disclose the code :( But perhaps it may inspire someone else


[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Go to full version