I've made a subclass of Window, but any use of the mouse event methods
throws a TypeError complaining about incompatible function signatures.

----------------
import pyglet

class MyWindow(pyglet.window.Window):
    CAPTION = 'MyWindow'

    WIDTH = 800
    HEIGHT = 600

    def __init__(self):
        super(MyWindow, self).__init__(
          width = MyWindow.WIDTH,
          height = MyWindow.HEIGHT,
          caption = MyWindow.CAPTION)

    def on_mouse_press(x, y, button, modifiers):
        pass

    def on_mouse_release(x, y, button, modifiers):
        pass

    def on_mouse_drag(x, y, dx, dy, buttons, modifiers):
        pass

    def on_draw(self):
        self.clear()

if __name__ == '__main__':
    window = MyWindow()
    pyglet.app.run()
----------------

This is the error I get for mouse presses:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/window/carbon/__init__.py", line 1100,
in _on_mouse_down
    self.dispatch_event('on_mouse_press', x, y, button, modifiers)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/window/__init__.py", line 1219, in
dispatch_event
    EventDispatcher.dispatch_event(self, *args)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/event.py", line 352, in dispatch_event
    event_type, args, getattr(self, event_type))
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/event.py", line 399, in
_raise_dispatch_exception
    (event_type, len(args), descr))
TypeError: on_mouse_press event was dispatched with 4 arguments, but
handler on_mouse_press at test.py:15 has an incompatible function
signature

This is the error I get for mouse releases:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/window/carbon/__init__.py", line 1113,
in _on_mouse_up
    self.dispatch_event('on_mouse_release', x, y, button, modifiers)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/window/__init__.py", line 1219, in
dispatch_event
    EventDispatcher.dispatch_event(self, *args)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/event.py", line 352, in dispatch_event
    event_type, args, getattr(self, event_type))
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/event.py", line 399, in
_raise_dispatch_exception
    (event_type, len(args), descr))
TypeError: on_mouse_release event was dispatched with 4 arguments, but
handler on_mouse_release at test.py:18 has an incompatible function
signature

And this is the error I get for mouse drags:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/window/carbon/__init__.py", line 1158,
in _on_mouse_dragged
    x, y, delta.x, -delta.y, button, modifiers)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/window/__init__.py", line 1219, in
dispatch_event
    EventDispatcher.dispatch_event(self, *args)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/event.py", line 352, in dispatch_event
    event_type, args, getattr(self, event_type))
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/site-packages/pyglet/event.py", line 399, in
_raise_dispatch_exception
    (event_type, len(args), descr))
TypeError: on_mouse_drag event was dispatched with 6 arguments, but
handler on_mouse_drag at test.py:21 has an incompatible function
signature

-- 
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