I'm writing a very simple app using Glade and PyGtk. In the app, I need to collect user inputs and parse it as a conf file. In order to dump all the freetext user inputs to a StringIO, I am using the on_xxxxxxxx_activate signal.This solution requires the user to hit Enter for the signal to be emitted. Instead I would like to use a signal which emits on focus change (switching to any other field). Does PyGtk provide a signal like that?


The behaviour I am looking for here is the one used by gtk_editable_insert_text. Is there a way of linking a GtkEditable's signal to GtkEntry?

1 Answer 1


gtk.Entry implements the gtk.Editable interface, so you can use those methods on your entry widget without problems. But if I understand your question correctly, you don't want the insert_text signal. You should rather use the focus-out-event.

  • focus-out-event is exactly what I need, but isn't it a Boolean? I mean doesn't it return a True/False result? Also implementing in the code gives an error on_servername_focus_out_event() takes exactly 2 arguments (3 given). Even though only two arguments are used.
    – boywithaxe
    Jul 27, 2012 at 9:21
  • Actually, ignore that comment.I fixed it by putting a 3rd argument into the functions, in this case on_servername_focus_out_event(self, widget, list). Thank you for your help! ;)
    – boywithaxe
    Jul 27, 2012 at 9:57
  • A signal/event doesn't return anything, it is just called when the connected event is emitted. The second (or third in a method) argument is the event, not a list. So it becomes: on_servername_focus_out_event(self, widget, event)
    – Timo
    Jul 27, 2012 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.