Blog series on using GTK with the D language

Your blog looks really nice.

I have just discovered it, had not time to really read it. I assume that you have a very good understanding of GTK3 and maybe upcoming GTK4 and do not teach us only old GTK2 stuff already covered by Andrew Krauses book, so then we maybe can translate the contents to other languages too. I would be interested to do it for Nim then, maybe others can do it for Rust, C++, Python or even plain C.

I have his book and I do refer to it from time to time, but for the most part, I’ve just struck out on my own and I follow my nose. My aim is to provide answers to 95% of the questions the average developer may have when it comes to GTK.

And anything that’s been deprecated I don’t mention. One of my aims is to make this blog as future-proof as possible within human limitations.

I haven’t yet started on GTK 4, but I’m aware of the pending release. Once it’s ready, I’ll check to see what’s changed and/or deprecated and make the necessary adjustments to my examples and documentation.

I’ve been thinking about how I might write a coder’s Rosetta stone, a guide to translating the examples on the blog into other languages. I’m not sure yet how involved this would be and I’ve got a lot on my plate ATM, but it’s an intriguing idea.

Thank you for your kind words, Stefan.

I just did a short investigation of your current tutorial. My impression is, that currently most is still GTK2 based, for example GAction/GMenu is not yet covered (that is something I have to read about soon, as I can not remember. And yes I know ebassi, there is a chapter in gtk howdoI, will read that. ) I also looked at some of your example code, it is nice that you provide full self contained stand alone examples for all of your explanations.

In

https://github.com/rontarrant/gtkDcoding/blob/master/009_grid/grid_009_01_checkerboard.d

I was a bit confused about line 8

import gtk.EventBox; // Labels can’t have a background color, so we pack them in EventBoxes which can

Sure can labels have background, it is done with Css. I know some people say that it is not easy enough, so I provide a Nim example in

https://github.com/StefanSalewski/gintro

It is in the middle of that page, above is the C code from which it was derived.

Do you know which GTK3 version is currently supported by D-Lang? Are the D GTK language bindings done by Gobject-Introspection?

[EDIT]

Well, google already answered my last question: DGTK is indeed gobject introspection based and latest version is actual 3.24. (https://github.com/gtkd-developers/GtkD) I am indeed surprised that there seems to exists still some activity concerning the D-lang GTK3 bindings…

One note for your blog posts, maybe it would be nice to add some more pictures. In these days younger people often have mental problems reading pure text, they need pictures and even videos. (People even create videos to teach programming and programming languages – I still wonder if that is why the authors have trouble writing text, or why the youtube watchers have trouble reading. Well both reasons seems to be strange, must be difficult programming software without reading capacity.)

I started with the old-school stuff first, so I haven’t yet covered CSS, but I will at some point.

I haven’t run across Nim before. Thanks for bringing it to my attention. On the surface, it seems very similar to Python. Now my curiosity is up and I’ll have to look into it more.

I may add screenshots at some point.

As to the reading problems… it’s been said that no one is an expert on anything until they’ve put in 10,000 hours. Perhaps these young people just need to practice more. :slight_smile:

From significant whitespace (no {}) and high level constructs it may look like Python, but it is indeed very similar to D, a modern but not that mature variant.

1 Like

Just a heads-up…

Here’s a quote from Migrating from GTK 3.x to GTK 4:

Do not use widget style properties

Style properties do not exist in GTK 4. You should stop using them in your custom CSS and in your code.