Useful documentation for GTK

A list of useful links for writing applications with GTK.

  • The getting started tutorial in the API reference.
  • The GtkTreeView tutorial. An overview on GtkTreeView, GtkTreeModel, and related classes. It was written for GTK 2.x, but the API and design haven’t changed since then.
  • The “How do I” pages on the GNOME wiki. A list of short guides to help you implement specific functionality for integrating with GNOME.
  • The GTK Inspector; the inspector allows you to query the state of any GTK application, and change things like widget properties and CSS styling at run time.
  • The GTK icon browser utility.

Will try to keep this up to date. Suggestions and links welcome!


Introduction to GTK application development with Vala by Alecaddd:

1 Like

Maybe Relm incl could be added.

1 Like

OK, I just subscribed as you suggested on the gtk mailing list. But I am some sort of sceptical still, can not really believe that Mr E. Snowden joins this discourse forum.

For the documentation, when someone ask me, I generally point people to

Often people are not able to find these.

Recently I discovered that a PyGTK book exists – never heard about that one before. Seems to be a clone of the C book from 2007 of Mr. A. Krause.

And finally, we have some Nim bindings with a mini tutorial too:

[EDIT] I just remembered the DEVHELP tool, which is designed to discover the GTK C API. I think it is very helpful to find structures and functions fast, also for languages other than C. I used it a lot when I wrote the experimental NEd Nim editor some years ago. I just launched it again, seems still to work, but fired some errors messages unfortunately: “(devhelp:1988): GLib-CRITICAL **: 07:41:58.732: g_source_set_ready_time: assertion ‘source->priv != NULL’ failed”

1 Like

Step by step GtkGLArea examples: Brick out, Asteroids, and Space Invaders

1 Like


A blog covering usage of GTK with the D language. 35 entries and counting…

Topics to date:

  • installation of a D and GtkD development environment in both Linux and Windows,
  • various Window widgets and operations (sizing, placement, etc),
  • Buttons (image, labelled, radio, checked, etc.),
  • Menus, sub menus, as well as using images, checkboxes, and radio buttons as menu items,
  • accelerator keys and mnemonics,
  • Containers such as Boxes and Grids,
  • signals, callbacks, and events,
  • harnessing mouse events including the scrollwheel,
  • OOP development for D and GtkD.

Future topics include:

  • Dialog windows of various types,
  • spin, volume, and scale buttons,
  • combobox, comboboxtext, liststore and treeview widgets,
  • a bunch more that are still in the planning and research stage.
1 Like

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.


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

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?


Well, google already answered my last question: DGTK is indeed gobject introspection based and latest version is actual 3.24. ( 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

The second post on the gtkDcoding blog this week continues the series on Dialogs. This one is about opening files

I hope you find it informative.

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.