this post was submitted on 03 Apr 2025
48 points (100.0% liked)

Linux

1270 readers
20 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hello all,

I'm trying to get into GUI programming, but am hesitating on using a Python library to make my first barebones program. My goal is to code basic buttons and understand how operating systems implement the way they draw windows for applications.

I have coded mostly in scientific libraries or high-level languages that are fairly simple (Python, Matlab, Julia)... Also am familiar with basic concepts and syntax from C.

Looking for recommendations to start. I am happy to learn a new PL. Interested in writing code for legacy hardware and mobile. Bonus if the codes are general enough to be written for most displays one could interact with.

top 18 comments
sorted by: hot top controversial new old
[–] cy_narrator@discuss.tchncs.de 3 points 3 days ago* (last edited 3 days ago)

pyqt5 or tkinter

[–] eveninghere 1 points 2 days ago (1 children)

How OS

Pretty much Qt. You can learn how different OSes have different way.

However, modern GUI programming is happening on the web and mobile phones. React is popular, but it's too high level and their XML-based approach is horrifically designed. Swift UI is nice, but it's Apple-only. Flutter is a good middle ground, but its Desktop capability is limited. You're going to shoot on your own foot several times.

[–] ReversalHatchery 2 points 2 days ago

~~modern~~ massively resource wasting GUI programming is happening on the web and mobile phones

there, I fixed it for you.

[–] KindaABigDyl@programming.dev 10 points 4 days ago* (last edited 4 days ago) (1 children)

Slint

I really like Slint.

It has Python bindings, tho you wouldn't know it from the docs as it's brand new bindings.

However, it does WORK, and it works well.

Just look for python files in the examples and reference the slint docs (it uses its own UI lang for that stuff anyway).

I'm currently making an application in Python using Slint, and I really like it.

It also supports embedded systems, the web, and multiple languages, AND since it has its own UI lang, you can reuse parts of your UI code across different codebases

It seems to suit your use case.

Godot

Other than that, I second Godot.

HOWEVER

Godot's GD Script is not Python but rather a Python-like language. (in fact, in some ways, I'm glad it's not; there are things I prefer in GD Script).

This is important as you may want to use specific Python libraries which won't work with Godot!

You can, however, use GD Native to bind C++ code and thus C++ libraries, so you'll still be able to get done whatever you need to get done.

Iced

If you're not tied to Python, then I recommend the Rust library Iced as it is a very intuitive system. I really enjoy working with it.

Although, that said, Slint has great support for Rust, so maybe I'd recommend Slint anyway if you were gonna change language.

Warning Against Legacy

Avoid GTK, Qt, and TK at all costs imo. Also WinForms if ur on Windows.

They're old and crusty, and their APIs suck to use, even modern versions, and despite being aged, they're buggy still, not robust "tried-and-true" methods.

It's also hard to do dynamic stuff with them.

Just not well designed systems. Important, valuable to know bc they're used all over, but not well designed

Immediate

I would also try ImGUI.

It's meant more for gamedev UIs rather than Apps themselves (tho I've made a couple in it)

BUT

It's a totally different way of doing UI called "Immediate" bc you program the elements in a big loop, rather than event driven.

It's interesting and worth trying as a learning experience

React

And ofc, the Javascript/Electron world is huge and React is very popular with lots of tools. At least read up on it.

[–] fossphi@lemm.ee 5 points 3 days ago (1 children)

Very interesting of you to call gtk and qt legacy . Is this a common belief? I'm surprised to see this and never came across it before

[–] KindaABigDyl@programming.dev 2 points 3 days ago* (last edited 3 days ago)

The modern version of Gtk and its APIs started with the switch to Cairo back in Gtk 2.8 circa 2005. While Gtk 3 and 4 have undoubtedly improved upon Gtk 2, they fundamentally still work in a similar paradigm and still have all the crust of a 20 year old library. Like most old software projects, it has some level of backwards compatibility and deprecates and adds slowly. Gtk is, like, the definition of legacy, and Qt is in a similar boat. They're OLD old.

[–] liliumstar@lemmy.dbzer0.com 9 points 4 days ago

You could get started with Qt, specifically the legacy widgets. There are bindings for Python available (pyside or pyqt) if you don't want to learn C++ or another language right away. You can also port your GUI definitions to other languages at a later date.

[–] lumony@lemmings.world 6 points 4 days ago* (last edited 4 days ago) (1 children)

Bless you for doing god's work. We need more GUI developers and a better ecosystem as a whole.

That said, it's pretty shite right now. Your established options are GTK and Qt. Qt uses C++ and I believe GTK uses C. I've only really looked briefly into Qt development, and it looks like there are bindings to Rust.

That said, I'm a firm believer that doing GUIs through code is an inefficient, cumbersome, and antiquated process that should be replaced with more visual alternatives, like we see in Godot Engine.

[–] ReversalHatchery 2 points 3 days ago

That said, I'm a firm believer that doing GUIs through code is an inefficient, cumbersome, and antiquated process that should be replaced with more visual alternatives

what do you mean? I'm not familiar with Godot.

Android comes to mind where most commonly you build the UI in XML. what do you think about that?

[–] alfredon996@feddit.it 4 points 4 days ago

My goal is to code basic buttons and understand how operating systems implement the way they draw windows for applications.

So do you want to program a GUI yourself, and not using a library, correct ?

[–] Aceofspades@lemmy.ca 4 points 4 days ago

You can start with Tkinter since it's a standard python library. Here's a tutorial to get you started.

https://www.geeksforgeeks.org/python-tkinter-tutorial/

[–] eugenia@lemmy.ml 4 points 3 days ago

If you prefer non-kde apps, then consider Vala. It's a young-ish language and it's well suited for Gtk apps.

[–] DieserTypMatthias@lemmy.ml 4 points 4 days ago (1 children)
[–] Uebercomplicated@lemmy.ml 1 points 3 days ago

+1 it was a tun of fun for me and rust is great

[–] silverhand@reddthat.com 3 points 3 days ago

Beeware!

Toga is a blessing. You can make apps for Windows, MacOS, Android, iOS, Linux and Web - all with the same codebase!

[–] wuphysics87@lemmy.ml 3 points 3 days ago

If you are interested into dipping your toes into rust land there is a library called Iced that I have used before. I at least like it better tham pyqt

[–] dessalines@lemmy.ml 2 points 3 days ago

I don't see much point in making GUI apps for desktop nowadays, especially since desktop usage is in decline compared to smartphones. If you still want to, I'd go with iced, which is in rust, and well designed.

I'd recommend learning either android jetpack-compose, or iOS app dev.

[–] EffortlessEffluvium@lemm.ee 2 points 4 days ago

I just know I’m gonna get raked, but try Lazarus. A Delphi clone using the FreePascal compiler. Has a framework similar to the VCL, but has pluggable backends. Qt, GTK, Windows, Cocoa, and a native one, though I’m not sure of its maturity. Component programming that is relatively easy to extend.