Enable PyGTK Eventbox motion-notify-event while is a Layout child
- by mkotechno
I noticed when a Eventbox is added into a Layout some events are missed, this does not happend for example adding it to a Fixed (very similar widget), I tried to restore the event mask in this way with no sucess:
import pygtk
import gtk
def foo(widget, event):
print event
pygtk.require('2.0')
window = gtk.Window(gtk.WINDOW_TOPLEVEL)
window.connect('destroy', lambda x: gtk.main_quit())
eventbox = gtk.EventBox()
eventbox.connect('button-press-event', foo) # works
eventbox.connect('motion-notify-event', foo) # fail
eventbox.set_events(
gtk.gdk.BUTTON_MOTION_MASK| # restoring missed masks
gtk.gdk.BUTTON1_MOTION_MASK|
gtk.gdk.BUTTON2_MOTION_MASK|
gtk.gdk.BUTTON3_MOTION_MASK)
layout = gtk.Layout()
image = gtk.image_new_from_file('/home/me/picture.jpg')
layout.add(image)
eventbox.add(layout)
window.add(eventbox)
window.show_all()
gtk.main()
How should I restore the missed event/mask?