Adding a property to all Gtk.DropDown objects

Hi. I would like to add a property to every object of type Gtk.DropDown.

I assume I would do this via “install_property”: GObject.ObjectClass.install_property

I can’t find an example of a GParamSpec in Python. I also don’t know what the property_id is that I should pass. Are there any examples of doing this in Python?

You cannot add a random property to a random class unless you are the creator of that class.

Ouch! OK so I’m trying to use bind_property() to bind values in a model to various widgets. Gtk.Entry is easy. For Gtk.DropDown … there is no direct way to set up a binding, as set_selected() takes a model position. I was going to add a property to each DropDown, bind to that, connect to the ‘notify’ signal, convert the value being set into a model position, and then call set_selected() on it.

It sounds like this is not possible? Are there alternatives? I understand that Gtk Expressions may be an option with “very recent” versions? What version might I need, and are there any python examples for this?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.