[pygtk] Bug in gtk.ComboBox with focus-out-event?
Sebastian Pölsterl
marduk at k-d-w.org
Wed Mar 15 20:16:49 WST 2006
Hi!
I just played around the focus-out-event that every widget should emit.
Unfortunately, this signal won't emit if I connect it to a gtk.ComboBox.
I created s simple example that should show the problem.
Is this a real bug, or am I just wrong?
--
Greetings,
Sebastian Pölsterl
-------------- nächster Teil --------------
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import gtk
class Window ( gtk.Window ):
def __init__(self):
gtk.Window.__init__(self)
self.set_title('TreeView test')
self.set_default_size(200, -1)
self.set_border_width(6)
self.vbox = gtk.VBox(spacing=6)
self.add(self.vbox)
self.entry = gtk.Entry()
self.entry.set_activates_default(True)
self.vbox.pack_start(self.entry, False, True, 0)
self.checkbutton = gtk.CheckButton('Press me please!')
self.vbox.pack_start(self.checkbutton, False, True, 0)
self.liststore = gtk.ListStore(str)
cell = gtk.CellRendererText()
self.combobox = gtk.ComboBox(self.liststore)
self.combobox.pack_start(cell, True)
self.combobox.add_attribute(cell, 'text', 0)
self.vbox.pack_start(self.combobox, False, True, 0)
self.button = gtk.Button('Quit')
self.button.set_flags(gtk.CAN_DEFAULT)
self.vbox.pack_start(self.button, False, True, 0)
self.button.grab_default()
self.connect('delete-event', gtk.main_quit)
self.button.connect('clicked', gtk.main_quit)
self.combobox.connect('focus-out-event', self.on_focus_out_event)
self.checkbutton.connect('focus-out-event', self.on_focus_out_event)
self.entry.connect('focus-out-event', self.on_focus_out_event)
self.show_all()
return
def set_data(self):
for row in ('one','two','three','four','five'):
self.liststore.append([row])
return
def on_focus_out_event(self, widget, event):
print '%s called focus-out-event' % widget
return
if __name__ == '__main__':
win = Window()
win.set_data()
gtk.main()
More information about the pygtk
mailing list