[Sugar-devel] Activity title update

Tomeu Vizoso tomeu at sugarlabs.org
Tue Jul 6 05:05:34 EDT 2010


On Mon, Jul 5, 2010 at 17:57, Bernie Innocenti <bernie at codewiz.org> wrote:
> On Mon, 2010-07-05 at 16:37 +0200, Tomeu Vizoso wrote:
>
>> But you can do the same with Gtk+, cannot you?
>>
>> "This signal is emitted when the Return or Enter key is pressed or the
>> line edit loses focus"
>
> No, GTK does not seem to send a "focus-out-event" when the user clicks
> on the close button. Which is what makes my approach fail.

Ok, that's quite different from what I read initially.

Have made a little test that seems to show that when the user clicks
on a button and a text field had the focus, the focus is moved from
the field to the button and thus focus-out-event is emitted:

import gtk

def focus_out_event_cb(entry, event):
    print 'focus-out-event'

def button_activate_cb(button):
    gtk.main_quit()

w = gtk.Window()
w.show()

hbox = gtk.HBox()
w.add(hbox)
hbox.show()

e = gtk.Entry()
e.connect('focus-out-event', focus_out_event_cb)
hbox.add(e)
e.show()

b = gtk.Button('mec')
b.connect('clicked', button_activate_cb)
hbox.add(b)
b.show()

gtk.main()

Have printed the C traceback in focus_out_event_cb and it seems to be
emitted when the button gains focus.

Any idea why this is not working in the activity toolbar?

Regards,

Tomeu

> --
>   // Bernie Innocenti - http://codewiz.org/
>  \X/  Sugar Labs       - http://sugarlabs.org/
>
>


More information about the Sugar-devel mailing list