You have a #Gtk4 application, written in python with #PyGObject, which use a template to build a window.
If you define a callback in code but you do not use it in template, an exception is raised.
If you use a callback in template which is not defined in code, no errors are reported.
But.
CSS classes are not applied to widgets. 🤷
Look:
With the callback:
Without the callback:
I lost some good hours trying to find why my button was not styled.
#Gtk 4.16.5
like this
Today I've worked on a little on my toy python-only Gtk UI Light Language (GULL), which is an experiment to write a lighter, more compact, UI definition file for #GTK instead of XML.
My experiment works only with python, as the code which parse and build widgets is all in python/py-gobject . It has also some nice functionality, like import other definition files as widgets and python module to connect functions to events. Oh and probably will ever support only Gtk3, because it's a toy, I'm lazy and I didn't started to look into Gtk4 yet...
I was thinking about writing a "converter" from my format into XML, to be able to use it via standard GtkBuilder.
My ugly code is here: git.sr.ht/~fabrixxm/gull
And now I stumbled on this jwestman.net/2021/10/22/a-mark… by @James Westman
I see we both come on that from the same thread on #GNOME discourse 😀
discourse.gnome.org/t/simplify…
A Markup Language for GTK
GTK has an XML-based format for declaratively constructing user interface components, but I've wanted to make a dedicated markup language for quite a while. This is my new prototype.www.jwestman.net
James Westman likes this.
nicoz :debian:
in reply to Fabio • • •