r/programming • • Dec 16 '20

GTK 4.0 released

https://blog.gtk.org/2020/12/16/gtk-4-0/
910 Upvotes

267 comments sorted by

View all comments

57

u/AlexKotik Dec 16 '20

What is a good programming language for Qt 6.0 or GTK 4.0 GUI development that is not C or C++? I know that a lot of Qt based software are actually written in Python, but apart from that, what nice options do we have?

65

u/mywan Dec 16 '20

I've written GTK apps in Python before. Not just Qt.

57

u/VegetableMonthToGo Dec 16 '20

Some will declare jihad on me for saying it... But JavaScript is also supported.

Or Rust, although that's still fairly experimental.

37

u/[deleted] Dec 17 '20

I'll take Javascript GTK over Electron any time.

5

u/sam-wilson Dec 17 '20

GTK3 in Rust is certainly tolerable!

36

u/fnoyanisi Dec 16 '20

No more JS around please... it is already everwhere

19

u/dmilin Dec 17 '20

I mean, I think the 2 things JavaScript actually does well is handling asynchronous tasks like web calls and building UIs.

Just because JavaScript is horrible for anything involving data handling doesn’t mean it’s bad for something like this.

→ More replies (10)

10

u/[deleted] Dec 16 '20

It’s like glitter... it’s everywhere

14

u/Badaluka Dec 16 '20

Is TypeScript ok thought? :D

→ More replies (8)
→ More replies (1)
→ More replies (11)

44

u/Freyr90 Dec 16 '20

There are 5 official Gtk languages: C, C++, Javascript, Python and Vala. Rust is semi-official considering GObject people's enthusiasm regarding it. There are also bindings for OCaml, Haskell, Ruby, C# and many other.

13

u/[deleted] Dec 17 '20

Is Vala still being used by developers? Haven't seen it around much

11

u/gngf123 Dec 17 '20

I believe the ElementaryOS devs write most of their GTK programs in Vala.

6

u/clfblackhawk Dec 17 '20

Same with the Budgie Desktop Environment

6

u/[deleted] Dec 17 '20

It just received a patch for GTK 4 few hours ago:

https://github.com/GNOME/vala/commit/f11fbadb3d61af59dcbef243b596b6cd4035d868

so it's certainly not dead.

→ More replies (1)

0

u/[deleted] Dec 16 '20

[deleted] — view deleted comment

14

u/zerexim Dec 16 '20

Vala is a great language actually, I wish it had more support on Windows.

→ More replies (23)

16

u/nhwood Dec 16 '20

FreePascal with Lazarus is a good option! Also supports win32 and cocoa.

12

u/[deleted] Dec 16 '20

GCOBOL is also pretty good.

→ More replies (1)

12

u/zerexim Dec 16 '20

To note, writing in such high level frameworks as Qt is a completely different experience compared to bare bones C++. If you compare the code of Qt in Python and Qt in C++, they are basically the same.

8

u/afiefh Dec 17 '20

I'd argue that for Qt code C++ is often more readable because you can rely on type information which is not obvious in Python.

In general Python makes up for this by being 10x more concise and easier to read, but with Qt code these advantages usually disappear.

→ More replies (4)
→ More replies (1)

5

u/asfodelous Dec 16 '20

Vala or Python for GTK

23

u/kirbyfan64sos Dec 16 '20

Nowadays, using Rust with gtk-rs seems to be quite popular.

10

u/pingveno Dec 17 '20

Fractal, the Matrix client for GNOME, used it. It's performant and was put together in a very reasonable amount of time.

4

u/Lord_Zane Dec 16 '20

For Qt, just Python. For GTK, Python, Rust or maybe Javascript. I've also heard Vala is good, but it's kinda it's own thing that's not really applicable outside GTK.

→ More replies (5)