How can I get the name of an object from GTK Builder?

How to get the name of Gtk.Widget extracted from the Builder object?

I mean the name visible in Glade (for example: button1 ), not the class name ( GtkWindow ).

This question is exactly the same as this one , but for Python with an introspection of GObject.

+2
source share
1 answer

You cannot use the get_name method inherited from Gtk.Widget . Instead, you should use the get_name method defined in Gtk.Buildable , for example:

 button = builder.get_object("button1") print(Gtk.Buildable.get_name(button)) # prints "button1" 
+2
source

Source: https://habr.com/ru/post/902346/


All Articles