D is one of the best general-purpose programming languages, as I describe in a text at the D programming language course page. (Actually, I claim that D shares with Rust the title of the best programming language.) How good is D specifically for GUI programming?

In GUI programming everything is the used GUI library. So to answer the question asked in the previous paragraph, I will review in this post several GUI libraries and show how D improves GUI programming with help of these libraries.

First, note that there is a fairly big selection of D language GUI libraries. I can’t review all of them in this post, so I will focus on two: GtkD and QtE56.

GtkD

GTK+ is the native GUI library of the leading Linux/Unix desktop environment Gnome. It’s like winui.dll but for Linux (and better). I know GTK+, it is done almost as perfectly as a C library can be. “The GTK programming interface is based on Object Orientation; widgets are organized in a hierarchy of classes—for instance, the window widget is also a specialised container, called a “bin”, that can hold at most one child widget. A window will be able to use functions that pertain to the widget, container, bin, and window classes.”

Note on naming: “At some very early point… (and before version 1.0), it was renamed to GTK+… On 2019-02-06, the project was renamed back to GTK, which will affect version 4.0 onwards.”

GtkD is a wrapper around GTK+. GtkD is outdated: It is a wrapper around Gtk+ 3.22, while the last GTK+ version is 4.8.1.

There are API docs, but for many (but not all) of them only list D declarations without textual descriptions, some help is just copied from GTK docs without adapting to D. So to understand the meanings you need to look into the docs of underlying library, GTK3.

The bindings to GTK+ are thin: For example, D properties are not used (like button.active, button.active = true), but instead “raw” getters are used: button.getActive(), button.setActive(true).

However, as a plus: GTK signals match to corresponding D delegates property; you don’t need to deal with raw C pointers.

Also note that GTK supports native Windows theme, for your app to have the same look and feel as other Windows application.

The conclusion: GtkD, despite of being outdated and too thin C bidings and having partial API docs is a nice choice for UI development on multiple operating systems (Windows, Linux, and many more).

QtE56

Like GtkD, the Qt bindings for D are outdated: The latest Supported version of Qt is 5.6, while Qt 6.4.0 has been already released.

Qt is multi-platform, too.

It uses dynamic Qt5 loading and a predefined set of slots, allows you not to use the metacompiler. To compile and execute an application, it is enough to have only QtE5 and some DLL/SO from Qt. There is no need to install Qt.

The same as GtkD, QtE5 does not use D properties (so we have: button.checkState() and button.setCheckState(…)), but worse only C functions (use extern(C) in D code) are supported as callbacks. The documentation how to use callbacks (without callbacks you can’t create an UI) is in Russian language.

You can get the native windows look and feel, but it is more difficult than for GtkD.

Conclusion: To use QtE5, you need to know Russian and use C callbacks. Thumbs down.

Final conclusion

D is a nice language for GUI development using GtkD, but the version of GTK used is outdated and D powerful features are not used in the C library bindings. Nevertheless, it is convenient to write GtkD UI code. If you don’t mind the outdated version of GTK, D is one of the best programming languages to developed GUI in, because of D powerful features useful for any projects, not just UI ones.

D is striving to become the best programming language for GUI, but misses a good and complete modern GUI library to get the title of the best.