Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Builderオブジェクトから取得したGtk.Widgetの名前を取得するにはどうすればよいですか?
button1具体的には、クラスの名前()ではなく、Gladeで見られる名前(例:)を意味しGtkWindowます。
button1
GtkWindow
この質問はこれとまったく同じですが、GObjectイントロスペクションを使用したPythonの場合です。
get_nameから継承したメソッドは使用できませんGtk.Widget。代わりに、次のようにでget_name定義されたメソッドを使用する必要がありますGtk.Buildable。
get_name
Gtk.Widget
Gtk.Buildable
button = builder.get_object("button1") print(Gtk.Buildable.get_name(button)) # prints "button1"