def on_mouse_motion ( self , x , y , dx , dy ) : # Screen coordinates relative to the lower-left corner
 # so we have to flip the y axis to make this consistent with
 # other window libraries
 self . example . mouse_position_event ( x , self . buffer_height - y )
how to program mouse clicks and movments with python
Pyglet specific mouse motion callback . Forwards and traslates the event to the example
def on_mouse_motion(self, x, y, dx, dy):
        """
        Pyglet specific mouse motion callback.
        Forwards and traslates the event to the example
        """
        # Screen coordinates relative to the lower-left corner
        # so we have to flip the y axis to make this consistent with
        # other window libraries
        self.example.mouse_position_event(x, self.buffer_height - y)