I just implemented a virtual trackball with pygtk, but it's not
quite right.  When I say

class Viewer(gtkgl.GtkGLArea):
  def __init__(self, width, height):
    gtkgl.GtkGLArea.__init__(self, 
      (gtkgl.RGBA, gtkgl.DOUBLEBUFFER, gtkgl.DEPTH_SIZE, 1))
    gtkgl.GtkGLArea.size(self, width, height)
    # ...
    self.add_events(
      gtk.GDK.BUTTON_PRESS_MASK
     |gtk.GDK.BUTTON_RELEASE_MASK
     |gtk.GDK.KEY_PRESS_MASK
     |gtk.GDK.KEY_RELEASE_MASK
     |gtk.GDK.POINTER_MOTION_MASK
     |gtk.GDK.POINTER_MOTION_HINT_MASK
    );

    # ...
    self.connect("motion_notify_event",
      lambda glarea, event, me=self: me.on_motion(event))
    self.connect("button_press_event", 
      lambda glarea, event, me=self: me.on_button_press(event))
    self.connect("button_release_event", 
      lambda glarea, event, me=self: me.on_button_release(event))
    # ...

I only get motion events at the instant when a mouse button is pressed or when
the mouse enters or leaves the widget.  When I remove the line

gtk.GDK.POINTER_MOTION_HINT_MASK 

I get all the motion events I want, but they aren't conveniently summarized
as one big event.  The annoying result is that the object on the screen
keeps on responding to events produced by the mouse up to a second ago.
Does anyone know how to fix this?

Thanks,
Issac



_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to