python - pygtk: find out focused element -
I am creating a dialog that shows what the element is centered what I wrote:
< pre> import gtk import gobject class FocusedElementPath (gtk.Dialog): def __init __ (self, parent, title = none): gtk.Dialog .__ init __ (self, title or 'Show path', parents father) self.catch_within = parents self.catch_focus = true self.add_button (gtk.STOCK_OK, gtk.RESPONSE_OK) again_btn = gtk.Button ( ', gtk.STOCK_REFRESH) again_btn.connect (' active ', self .refresh_pressed) again_btn Kso () Self.akshn_ariakaed (Agen_btn) Selfkaed_btn (Gtkkstok_kansil, Gtkkrispans_kansil) Self.akshn_ariakset_leaut (Gtkkbuttonboks_i DGE) self.path = gtk.Label () self.path .show () self.vbox.add (self.path) def refresh_pressed (self, btn): self.catch_focus = True def do_focus_out_event (self, evt): nl = self.catch_within.get_focus () If nl: self.catch_within .activate_focus () self.path.set_text (repr (nl)) else: self.path.set_text ( 'no') gtk.Dialog.on_focus_event (self, Evt) gobject.type_register (FocusedElementPath)
The problem gives an element already centered. What is the way to find the currently focused element? I have tried different events (for dialogue and for window), but nothing helps :( What am I doing wrong or how do I do it correctly?
(also gtk.Dialog ) in the child will return.
anyway I quite Do not understand what you want to get here ...
Comments
Post a Comment