V
V
Vladimir2013-03-21 13:51:10
Python
Vladimir, 2013-03-21 13:51:10

Getting the widget id

There is a GTK application whose interface is represented by XML generated in Glade.
How can I find out the id of the widget in which the event occurred by an event (for example, pressing a button in the Entry)?

entry.get_name() - returns "GtkEntry"

Code example:

...
    def __init__(self):
...
        self.builder.connect_signals({
            'on_entry1_insert_text': self.entryInsert,
            'on_entry2_insert_text': self.entryInsert
        })
...
    def entryInsert(self, entry, text, length, position):
...
        print entry.get_name() #выдает GtkEntry
...


Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2013-03-21
@koef

I figured it out myself :)
Need it instead

entry.get_name()
use
Gtk.Buildable.get_name(entry)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question