Thanks Tristam, but susprisingly that doesn't solve it.

I believe it's not so trivial. Even  if I do:

self.win.pop_handlers()
self.win.set_location(wx+dx,wy-dy)
self.win.push_handlers(self)

The set_location function still calls this on_mouse_drag handler .
I tried to redirect to another handler before moving, too.




El 20/05/2010 0:43, Tristam MacDonald escribió:
On Wed, May 19, 2010 at 6:20 PM, Txema Vicente<[email protected]>  wrote:
Hello.

I'm trying to move a borderless pyglet window in a drag event.
The problem is when I set the window location, it seems to produce another
"inverted" on_mouse_drag event.

This code reproduces the issue. Drag the window, then keep mouse button
pressed and you see the "resonance?".
Any idea to avoid the second event?


import pyglet

class testcase():

     def __init__(self):
         self.win=pyglet.window.Window()
         self.win.push_handlers(self)
         pyglet.app.run()

     def on_mouse_drag(self, x,y, dx, dy, button, modifiers):
         wx,wy=self.win.get_location()
         self.win.set_location(wx+dx,wy-dy)

testcase()

(Win7, python 2.5, pyglet 1.1.4)
The simple solution?

     def on_mouse_drag(self, x,y, dx, dy, button, modifiers):
         if not self.just_moved:
             wx,wy=self.win.get_location()
             self.win.set_location(wx+dx,wy-dy)
             self.just_moved = true

         self.just_moved = false

Why the phantom drag events occur is anybody's guess, but I have
observed similar issues with SDL/Mac in the past.


--
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en.

Reply via email to