Mojo-GTK: Autogenerated GTK bindings for Mojo

While experimenting with FFI a bit more, I wrote a few python scripts that generate bindings for GTK.

It contains most of GTK’s widgets and functionality and I also created a few demos for it. Setting it up is pretty simple, just install the GTK toolkit, add the link commands to pixi.toml’s [activation.env], MODULAR_MOJO_MAX_SYSTEM_LIBSenv parameter, and getting the gtk.mojo pre-generated file from the github repo.

I’ve only currently tested in on MacOS and Ubuntu.

I made a few demos too.

3 Likes

Fantastic work!

I will note for anyone trying this that I had to re-point the link paths and sprinkle some -Wl around to get it to work on Linux (Fedora).

1 Like

This is super cool, nice work!

Thanks. There’s also an OpenGL demo but I don’t think it’ll work on Linux because of how it look for the dll . I’ll probably fix it some time :man_shrugging: