Gtk.PropertyExpression.new return NULL (Gtk4&python)

property_expression = Gtk.PropertyExpression.new(GObject.TYPE_STRING, None, “string”)
return: TypeError: constructor returned NULL

The first argument needs to be a GObject type. G_TYPE_STRING is just the C string type (char *). I think you were looking for Gtk.StringObject.

Unfortunately, this still won’t work unless you have the very latest PyGObject with Fundamental type support (!250) · Merge requests · GNOME / pygobject · GitLab.

For alternatives in the meantime, see:

1 Like