Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

Addendum:

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.