Any recommendation from your personal experience? What GUI to use for Python?
- would like to be something "python-esque", easy to use for non-programmers, just like Python is easier to use for amateurs than, say, C++ would be.
- has to have a drag&drop graphic editor to add controls and design the GUI, designing the layout by writing code is not productive for me
- preferably open source and definitely free, it's for hobby and non-commercial projects
- for my level of skills, the old VB5 was just right, with drag and drop buttons and auto generated code, then all you have to do was to populate the empty template with code for the desired actions, would prefer an equivalent for that VB5 style, if there is any
- multiplatform preferably, Linux is a must
Googled already, and tried so far a couple of them:
1. Qt and its "Qt Designer" - (that was some time ago, IIRC the wrapper module was called PyQt), thought I remember it as very cumbersome, hard to learn and also Qt is not entirely free, certainly not FOSS
2. PySimpleGUI - that was the simplest to use so far, but there's no GUI designer for PySimpleGUI, only some unbaked attempts to import XML ui produced by Qt Designer, which import tool seems abandoned and doesn't work any more
3. DearPyGui - it's very "Windows-ish" (has a registry for its GUI no matter the OS), thought it's open source and with MIT license. The main drawback (for me) is that it's not really for preparing a GUI, but more for making/developing tools for 2D/3D games. DearPyGui is based on ImGui, a C++ lib/engine for game devs, which ImGui is sponsored by big names like Blizzard or Ubisoft. The Python wrapper is very impressive and working, yet it is too recent, the video tutorials from 1-2 years ago are almost not applicable to current version. And still doesn't have a drag and drop designer.
They are all great Python GUI programs, yet none are just right for me. The GUI part feels to me like a dragging or a chore task, maybe it's just me, or maybe I have wrong expectation, IDK. :-//
Been looking for something easy, to use for small/single person projects. For example to slap a GUI on a small board I make, or to control an existing devboards, or an instruments around the lab, things like that. For example adding a GUI for a data logger from a COM port, or a GUI for an SCPI tool to automate repeated measurements, or other small Python programs like that. I'm using mostly Linux/KDE (Kubuntu).
What did you guys are using for that, or seen and liked, when it comes to making a GUI, or what do you think I should try?
By using GtkBuilder, Glade XML files can be used in numerous programming languages including C, C++, C#, Vala, Java, Perl, Python,and others.
Looks very eye candy, will give Glade a try, too, thanks. :-+
Used C in the past, but now I prefer Python. Python is more productive, and has modules for anything, from math to controlling an RTL-SDR.
For amateur programmers like me, this is how writing in Python feels:
;D
apt install python3 from a root terminal, or use sudo.pip install matplotlib
pip install pyrtlsdrfrom pylab import *
from rtlsdr import *
sdr = RtlSdr()
# configure device
sdr.sample_rate = 2.4e6
sdr.center_freq = 95e6
sdr.gain = 4
samples = sdr.read_samples(256*1024)
sdr.close()
# use matplotlib to estimate and plot the PSD
psd(samples, NFFT=1024, Fs=sdr.sample_rate/1e6, Fc=sdr.center_freq/1e6)
xlabel('Frequency (MHz)')
ylabel('Relative power (dB)')
show()
python RTL-SDR.pyI have no idea what Python IDE full dev suite means. :o
AFAIK Python is only the interpreter for the Python language.
print("B a z i n g a !!!")Hit Ctrl+F5 to Run it, or F5 to Debug run it.pip install psutilimport psutil
import tkinter as tk
def update_label_2(): # a function to autoupdate the proc %
cpu_percent = psutil.cpu_percent()
label_2.config(text=str(cpu_percent))
GUI.after(100, update_label_2) # reschedule to run again after 100ms
GUI = tk.Tk() # create the top window of a GUI
label_1 = tk.Label(GUI, text=':o) CPU % :o)') # create a label inside top window
label_1.pack() # render the label_1 label
label_2 = tk.Label(GUI, text='100') # a second label
label_2.pack()
btn = tk.Button(GUI, text='E X I T', command=GUI.quit) # an exit button
btn.pack()
GUI.after(0, update_label_2) # schedule to call update_label_2 function at first run
tk.mainloop() # start the window loopHit Ctrl+F5 to Run it. A window with live processor usage will open.I use both Gtk+ 3.0 (in C) and Qt 5 (in Python 3) quite a lot.
wxPython is alive and well and runs under python 3.x nowadays. go to www.wxpython.org (http://www.wxpython.org) for details.Never tried wxPython before, because it seemed abandoned. The latest news in the linked page is from the end of 2020, yet https://github.com/wxWidgets/Phoenix (https://github.com/wxWidgets/Phoenix) seems active, with last submit from yesterday. :-//
Given the fact that visually I prefer the Qt/KDE look over Gtk/Gnome, is there any programming advantage to make one choose Gtk3 over something else?If we are talking about programming in Python, no.
Thanks for the link, there's a big collection there of how each GUI looks like under different OSs https://wiki.lazarus.freepascal.org/Screenshots
Used Turbo Pascal for a while, it's a nice language but I don't remember it as productive as Python. And there is another (unfair) advantage Python has, and that's the abundance of its modules. Because it is so popular, there is an already written module for almost anything you can imagine or need to do from Python.
(..)
Built some large things in wxpython. Can recommend. As for IDE VSCode is where it’s at these days. When I say where it’s at, I mean that there is significant community attention to actually make it a nice place to be.
Really though when I build GUI applications these days I tend to build them in Go as an http server and write the UI in HTML/JS. That has the advantage of producing a single cross compiled binary with no dependencies per platform, strong typing throughout, very low footprint. Most importantly it’s actually possible to write a decent test suite against a browser application compared to other solutions.
Built some large things in wxpython. Can recommend. As for IDE VSCode is where it’s at these days. When I say where it’s at, I mean that there is significant community attention to actually make it a nice place to be.
Really though when I build GUI applications these days I tend to build them in Go as an http server and write the UI in HTML/JS. That has the advantage of producing a single cross compiled binary with no dependencies per platform, strong typing throughout, very low footprint. Most importantly it’s actually possible to write a decent test suite against a browser application compared to other solutions.
Wow. Mind blown.
Do you know of a good tutorial where one could follow a hullo world example (and perhaps beyond) without too much install library hell?
1. Qt and its "Qt Designer" - (that was some time ago, IIRC the wrapper module was called PyQt), thought I remember it as very cumbersome, hard to learn and also Qt is not entirely free, certainly not FOSS
Built some large things in wxpython. Can recommend.
1. Qt and its "Qt Designer" - (that was some time ago, IIRC the wrapper module was called PyQt), thought I remember it as very cumbersome, hard to learn and also Qt is not entirely free, certainly not FOSS
Qt is entirely and certainly FOSS. Pick your license: GPL or LGPL at your choice.
I don't care and don't want to know who one is with, or against, or how righteous one might be, or not be, I just don't want activism/political endorsed software, no matter who's side it takes, and no matter how much technical merits that software might have.
I'm so full sick of any kind of propaganda. Writing code is a part of my tinkering hobbies, and I want to enjoy the time spent with a hobby project. I don't want to be reminded to worry about anything during that particular time frame. That's the whole point of doing a hobby activity: getting a refuge from the worries one might have because of the problems existing in the world, or in the own life. Also, I don't like to be told who's side to take, or to be guilt-tripped for not taking any side, and so on. Got enough propaganda trauma during Ceausescu's Romania, before 1989, and now (in the last decade) propaganda is at unbearable levels again, just like it was back then, except that now it's coming from other ideologies than back then. Same shit, different flavors.
There is this big list of GUI software for Python. :-+
https://wiki.python.org/moin/GuiProgramming
Adding it here just for the docs, and because it didn't pop in the previous searches.
I've written a fair bit of Pascal over the years. Just no.
Modern Object Pascal is pretty good. You may have myriads of reasons for not using it (the ecosystem, too few potential developers available, very few compilers, not standardized AFAIK, you already have a large code base in other languages and want to reuse it, etc), but if you're a lone developer or a small team for which those points are not a problem, go for it.
TurboVision based..
TurboVision based..
Do you really mean TurboVision, or are you actually talking about Free Vision ?
https://en.wikipedia.org/wiki/Turbo_Vision
https://wiki.freepascal.org/Free_Vision
Free Vision seems to be the FreePascal (IDE) version.
Ah, but FreeVision is text-based UI only, right?
I would call that UI, but not GUI.
But you can definitely design GUIs with FreePascal and Lazarus. It's close-ish to Delphi as far as I could tell, but I haven't touched either in ages so I'm not too sure.
Qt is entirely and certainly FOSS. Pick your license: GPL or LGPL at your choice.Anything and everything in Qt that an application developer can use, definitely. Everything Qt installed in Linux distributions is available under FOSS licenses.
If you say that software that's opensource and released under the GPL and/or LGPL isn't FOSS,The fact proprietary non-FOSS closed-source applications and libraries are explicitly allowed to dynamically link to any LGPL-licensed library/toolkit/framework, can be confusing to those who do not understand the core idea of FOSS: it is not about zero price, it is about end-user freedom.
then many software will not be FOSS like for example the GTK toolkit.
No longer than this morning I've tried to install the latest and greatest Qt, which is Qt6, only to realize that there is no Qt6 installer binaries. Then I've bumped into this blog https://embeddeduse.com/2020/02/02/less-love-for-foss-qt-users/ so it seems the last binary available without a Qt account was Qt5.14, and from that one on, one either has to register on Qt.io, or build from sources. :-//
Not sure if I properly understood that, but if it is so, then I'll strike out Qt from the candidates. I understood that I can build from sources without an account, but such a trend still worries me. Whatever needs an online account is a big no for me, will only use such products only if there is no other option.
I had to make an account on the QT thing (for this supposedly FREE open source software), rather/very annoying.
However, there is one or two Qt packages that are not licensed under FOSS licenses, and not available in standard Linux distributions. The main one is Qt for MCUs (https://doc.qt.io/QtForMCUs-2.1/qtul-licensing.html), which is only available under a commercial or an evaluation license.
I had to make an account on the QT thing (for this supposedly FREE open source software), rather/very annoying.
Absolutely not. Here you go:
https://ftp1.nluug.nl/languages/qt/official_releases/qt/ (https://ftp1.nluug.nl/languages/qt/official_releases/qt/)
And here is a mirrorlist if you prefer another source:
https://download.qt.io/static/mirrorlist/ (https://download.qt.io/static/mirrorlist/)
Due to The Qt Company offering changes, open source offline installers are not available any more since Qt 5.15. Read more about offering changes in the https://www.qt.io/blog/qt-offering-changes-2020 (https://www.qt.io/blog/qt-offering-changes-2020) blog.
If you need offline installers, please consider our new Qt for Small Business offering: https://www.qt.io/blog/available-now-qt-for-small-businesses (https://www.qt.io/blog/available-now-qt-for-small-businesses)
Maybe just the framework itself, QT. Can be downloaded.
Maybe just the framework itself, QT. Can be downloaded.
Not "maybe", for sure. But you are right about the installers and probably also Qt Designer and Qt creator (the IDE).
But you don't need them. I write software with grafical interfaces using Qt for 10 years and the only thing I need is the
Qt framework (the libraries), a good editor (Kate) and a compiler (GCC).
On Linux, programming with Qt is easy. When I want to release a windows version, I fire up a virtual machine and recompile
it for windows. No installer, no IDE. I simply download the Qt source and compile the libraries with MinGW-64.
Then I compile my program static. That way I don't need to install a gazillion of dll's when deploying my program
and I don't risk any version conflicts. The result is an executable with everything needed inside it.
Many people say, staying with text based solutions (which is exactly what you just said), is the best way, anyway.
Qt is why Electron is so popular…
The market is larger than that. There are an order of magnitude more applications behind closed doors. And they’re pushing towards web and electron over native GUI. One thing I have heard is that Qt is complicated to license and expensive to build. Plus there aren’t enough people who can actually do it out there.
I’m no fan of electron myself but it’s s viable tech for a good chunk of cases where Qt sat.
The largest thing I’ve seen recently was a fintech numerical analysis tool built in Electron and React. The processing was done with an external process which was C++.
I was agreeing with you, not arguing with you.However, there is one or two Qt packages that are not licensed under FOSS licenses, and not available in standard Linux distributions. The main one is Qt for MCUs (https://doc.qt.io/QtForMCUs-2.1/qtul-licensing.html), which is only available under a commercial or an evaluation license.
This thread is about a GUI for Python. So, I was clearly speaking about the Qt GUI framework which is FOSS.
Many people say, staying with text based solutions (which is exactly what you just said), is the best way, anyway.
When I started to program with Qt, I used Qt Designer, but I didn't like the generated code.
For sure it's easier for starters but as with everything, the risk is that you never learn Qt well enough.
By te way, the documentation of Qt is the best:
https://doc.qt.io/qt-5/reference-overview.html
When I'm programming, I usually have this page open so that I can easily jump to any class/widget:
https://doc.qt.io/qt-5/classes.html
And no, I haven't touched Qt6 yet, I stay with Qt5 untill Qt6 is complete and ready for production and when it's
the default Qt version Linux.
When I started to program with Qt, I used Qt Designer, but I didn't like the generated code.I don't like using code generators at all.
Apparently, there is a similar situation (of sorts) between GTK3(+) and GTK4. GTK4 is the latest one, but many things are still GTK3(+).Definitely. There are those who do (use Qt 6 and/or Gtk+4), but since Qt 5 and Gtk+3 work very well for now, there really isn't any reason to "upgrade" yet.
I also find it annoying with systems (but still might use them), which automatically write some of the code for you. On the one hand it makes it fast and easy, but it can adversely affect the source code.I don't like those either. I just wanted to point out that although Qt Designer supports that, it does not require one to generate the source code for the UI. Both Glade (Gtk+) and Qt Designer (Qt) support XML-based user interface descriptions as .ui files, that can be instantiated at run time.
Many, GUIs, are rather powerful and useful. But are significantly deficient on the documentation side, which can be a real pain in the neck.Very true. For Qt, I use the same doc.qt.io/qt-5/classes.html (https://doc.qt.io/qt-5/classes.html) as Karel mentioned. For Gtk+, I'm still using developer-old.gnome.org/gtk3/stable/ (https://developer-old.gnome.org/gtk3/stable/) and not the new developer.gnome.org/gtk3/stable/ (https://developer.gnome.org/gtk3/stable/) site, as I find the old pages faster to navigate; fewer clicks to find whatever I'm looking at.
I was agreeing with you, not arguing with you.However, there is one or two Qt packages that are not licensed under FOSS licenses, and not available in standard Linux distributions. The main one is Qt for MCUs (https://doc.qt.io/QtForMCUs-2.1/qtul-licensing.html), which is only available under a commercial or an evaluation license.
This thread is about a GUI for Python. So, I was clearly speaking about the Qt GUI framework which is FOSS.
It is important to be precise about licensing, as there is too much FUD flying around Qt licensing. Describing the Qt package (unrelated to this thread) that is not FOSS, shows the whole picture. As in "the border lies there, and it is miles away; thus, the claim is quite correct."
For Tkinter there is this standalone WYSIWYG editor called PAGE (https://sourceforge.net/projects/page/files/) (should work to generate Tcl/Tk, too), but I've tried it only for Python, and it worked. A little too basic, from sourceforge, seems straight from the 90s and not very intuitive for these days, but it kind of works. :)
I'm not sure if those are bugs, or if it's the expected behavior, but certainly PAGE is not as intuitive as VB5 was. PAGE works, but not very smooth, even if it were to judge it by the 90's standards.
About PAGE, on my desktop the Ctrl+Z does strange things, not really undo-ing, sometimes the graphic WYSIWYG is not synchronized with the tree view of the same elements, selecting more than one element (middle mouse) is not very intuitive (click and drag around elements doesn't select all the enclosed elements, things like Shift or Ctrl alterators behaves unexpected when used for selection, etc.), doesn't do multi-edit of the same property, things like that.
I'm not sure if those are bugs, or if it's the expected behavior, but certainly PAGE is not as intuitive as VB5 was. PAGE works, but not very smooth, even if it were to judge it by the 90's standards.
Given Python's shitty backwards compatibilty, this may be a useless exersize. This may work for a specific version but become broken once a new version is out.Aside from Python 2 to 3, which was annoying as all hell but carefully controlled and not a surprise to anyone, I haven't been bitten by that at all. Exactly what are you referring to?
Carefully controlled?It applied to the 2-to-3 thing. I'd rather have a rewrite/redesign/refactoring, than live with a sub-par design. Now that they know how painful it is, how likely do you think it is they repeat it?
"Python version incompatibilty is intentional" - When such statements come out right from the horse's mouth (Guido van Rossum, the creator of Python), that makes you think.
I’ve had about 15 million lines of it in production before. Not one issue. Even the python 2 to 3 port was smooth.Good for you. Total opposite experience here.
Then they tell you to try version 3.xyz instead of version 3.xzy...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 (https://www.kernel.org/doc/html/latest/admin-guide/bug-bisect.html).
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.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.
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. :()
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.For what it is worth, I tend to use GtkGrid or QGridLayout for widget layout, much like HTML tables, which scale automatically. I basically never use fixed layouts, as I need mine to scale according to my varying needs.
creating a bunch of contols using a for loop is quicker tooTrue. It really depends on the application, which is my point regarding an example. A synthetic example won't be useful much; we really need a real-world use case for it to matter.
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.Well, visualising signals and filters in time and frequency domains is an important tool in many sub-fields members here would be interested in. ;)
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!
It's also a bit hairy keeping track of the slot/signal connectionsWhen using Qt Designer .ui files, PyQt5.QtCore.QMetaObject.connectSlotsByName auto-connects on_widgetName_signalName slots to the named signals. Applying the Principle of Least Surprise, we can do that ourselves with just a couple of lines.