Poetry with Gtk.

Recently I’ve started playing with making desktop apps using Python. Among the available GUI toolkits I quite like GTK (especially with Glade / Cambalanche).

It requires a bit of extra steps to get started though.

So to actually use it you should install PyGObject. But for install to succeed you need to install devel files for cairo on your system first. Under OpenSUSE I did that with:

zypper in cairo-devel

Another dependency that was needed on my end was gobject-introspection, which I’ve added with:

zypper in gobject-introspection gobject-introspection-devel

With that done I could finally get to actually adding PyGObject in my project:

poetry add pygobject

It’s also good idea to add stubs for it as well, so it would work better with IDE of your choice.

poetry add pygobject-stubs

So this allowed me to start learning GTK inside Python and with the added benefits that Poetry brings.

Image(s):

Chris Ried, @Unsplash