Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
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 '12 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 '12 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 '12 at 22:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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