[Glade-users] glade and motion_notify_event



I have a GTK+ glade-2 application which I am controlling with libglade
and pygtk-1.99.14.

The main GtkWindow contains a GtkVBox, which has 3 entries: a
GtkMenuBar, a GtkDrawingArea, and a GtkToolbar.  I want the
GtkDrawingArea to respond to mouse motion events.

In the Signals tab of the GtkDrawingArea Properties window, I added
the signal motion_notify_event with the handler
on_drawingArea_motion_notify_event.  However, when I move my mouse of
the drawing area, this handler is never called, though other events
for the drawing area, namely configure and expose events, are called.

    # this handler is called
    def on_drawingArea_expose_event(self, widget, event):
        print 'expose'
        self.fig.expose_event(widget, event)
        return gtk.TRUE

    # this one is not
    def on_drawingArea_motion_notify_event(self, widget, event):
        print 'drawing area', event.x, event.y
        return gtk.TRUE

I thought maybe the problem was that the main window needed to respond
to motion events, so I added a signal/handler pair to the main window
(which contains the GtkVBox).  The odd thing is that this handler is
called, but only when the mouse is over the text in the main menubar,
eg, over the 'File' and 'Help' entries of the menubar

    # this is called but only over the menubar entries
    def on_windowMain_motion_notify_event(self, widget, event):
        print 'win main', event.x, event.y
        return gtk.TRUE


The GtkDrawingArea is in a GtkVBox, and I haven't connected the vbox
to any signal/handlers.  Is this why the drawing area's motion events
are handled?

I've uploaded my glade file to 

  http://nitace.bsd.uchicago.edu:8080/summer/jdh/main2.glade 

in case it contains any hints as to what I am doing wrong.

Thanks,
John Hunter




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]