I realize this is a very broad question, so to help I’ll mention that my primary experience with any programming language is Python. I’ve looked into C and C++ as well, but I haven’t written much in them; in part because they’re more involved, and in part because I get lost in the IDE weeds with’em (whether choosing an IDE or getting it configured to even get started tbh, but that’s mostly a different topic).
In Python I know there’s an option in Tkinter, and I’ve worked with it to some extent but never got entirely comfortable with it. Maybe it would be best to try making some more stuff with it instead of bouncing around different things, but would that be advisable over something that may be better suited to the task?
If it would be better to stick with it, what might be some things you wish you’d known starting out with GUI programming (whether particular to Python or generally applicable)?
While so many things are so much better than they used to be in the programming ecosystem, I feel like entry-level GUI programming is so much worse.
This will probably be an unpopular opinion, but Visual Basic (pre .NET) was one of the easiest ways to make a simple, contemporary (for the time) GUI. Drag and drop some elements, modify the UI properties, double click and add code. It made for an excellent introduction to programming because the UI portions were simple and intuitive enough to stay out of the way.
The rest of VB wasn’t great. Weird language/syntax/keywords keywords, closed environment, mediocre tooling. But for building UIs? I haven’t used anything as easy as that and it’s been over 20 years now…
I don’t have any recommendations unfortunately. Almost everything I do is web based or command line. Web UIs aren’t terrible, but there’s a learning curve and lots of limitations. Haven’t found anything for desktop apps I like lately (last one I built was also with tkinter for a small Python project. Bleh.)
Oh man this takes me way back. VB’s pick and drop UI builder was so magical. I used to do complex wizard based forms that are probably terrible if I look at them now (If I still preserved them… unfortunately I didn’t) but at the time they looked professional.
PyQt is pretty good and Qt is widely used, so may also be worth a look. The Qt designer is a nice way to separate out the look of the GUI elements, then work on connecting the app functionality to that after. I think the key is to start on something simple and work up, partially to learn the library and partially to learn the pitfalls of GUI development as you add features etc.
Is there something else like the Qt designer for working with PyQt/PySide? I looked on their site and even dug through to the open source licensed versions, but all the available installers seem to insist on making an account to proceed with installation. If that’s a no-go, then I may still try it at some point just without that tool.
https://www.pythontutorial.net/pyqt/qt-designer/
This should help. I believe the .ui files will work with both PyQt and PySide but I haven’t personally tried.
Yeah they will. The .UI files are handled by the cpp lib, so any wrapping lib will know what to do (code completion is a removed with it though)
Thanks, I think that will help!
The official one is https://pypi.org/project/PySide6/ and it includes some kind of designer for UI files (https://doc.qt.io/qtforpython-6/tools/pyside-designer.html). I use it at work to preview code meant for C++ and it works fine. The installation is easy too with pip.
I’d argue pyside is preferred to pyqt (pyside2 is the latest bindings for qt5 iirc). And personally, Ive found its documented very well and there are a lot of great (and not great) examples to find on the web.
I started learning c++ through qt, so imo pyside is a great way for UI logic in an easy language -> take known UI logic to c++ -> learn c++ more in general -> learning a second language opens you up to any subsequent languages because of how it teaches you to think. (Not that c++ is useful as a second language specifically, just another language in general starts opening you mind up a bit, especially if it uses different paradigms)
Edit: oh god, pyside6 is the latest. https://www.pythonguis.com/blog/pyside-tutorial-now-available/
When you said “GUI Programming” What kind of GUI are you talking about? A web-based GUI or a desktop-based GUI?
Web-based the go to framework is generally React or Angular.
If you’re talking about Desktop based, you probably want to stick with the language that you’re also building the logic in. Like you could use another language like C# and write a front-end in Avalonia, but then you’d have to interlop from C# to Python.
You could also pick a language that’s supported by Electron, then you’d basically be doing Web-Development but for desktop.
Oof, sorry, slipped my mind! I’d meant desktop-based (or device-based may be better these days?).
Well “Device based” is even more broad, haha. If you’re also including iOS and Android.
Then you’d be looking at a cross-platform developing lanuage, like Flutter, React Native, Xamarin etc.
So the question is, what is the goal for your GUI? Is this a personal project where you just want to have a GUI for a specific system? (Windows / iOS system) - Or something published that you want people to be able to use on all devices?
Is this a personal project where you just want to have a GUI for a specific system?
Mainly this tbh, in which case the answer for myself would be to limit to preferred platform, so I’ll focus mainly on desktops. I’ve skimmed over web stuff and it gets brambly fast from what I can tell, which also applies for cross-platform in terms of devices as you’ve reminded me. 😅 Overall it’s to simply learn how, as I enjoy good GUIs and think it might be nice to be able to make some.
With python there are so many directions you can take.
Tkinter is the built in option.
Kivy is open source.
Kivy MD is a Material Design focused fork of Kivy, but I think it is recommended you learn Kivy before learning Kivy MD?
Textual is a great open source TUI framework, if you don’t mind being in the terminal.
List of apps that use Textual from one of their developers
And of course QT (which has two variants for Python). I personally rather avoid QT just due to licensing concerns.
Main issue is with most python applications, is packaging for distribution of course. Would love to see python’s packaging problem finally solved in the core distribution, but -shrug-.
Both, https://wiki.gnome.org/Apps/Builder a d https://kdevelop.org/ are great starts
Professionally, we went with a python backend and angular frontend. Pretty easy to get set up with websockets or server sent events.
Sorry to that guy, but Python is a terrible choice for GUI. It simply doesn’t even exist in the wild, except in newbies’ minds. You should pick something that allows you to* easily & immediately* reload your GUI in progress without restarting the program; AND also maybe think about how to distribute your GUI on other computers without requiring them to duplicate your python setup
Tbh it’s not really what I was going for for learning GUI stuff, it’s just the language I’m more familiar with. It sounds like you have something that may be better in mind, in which case what might that be? Also to clarify, I’m more interested in desktop-based GUI programming/development.