Closed alexklaeser closed 11 years ago
It seems to be an issue with MonomeGridEvent inheriting from MonomeEvent (which only expects 1 constructor parameter). As soon as I remove the inheritance of MonomeEvent, it works.
The following patch works for me:
diff --git a/bindings/python/monome.pyx b/bindings/python/monome.pyx
index af750ec..bdee2e4 100644
--- a/bindings/python/monome.pyx
+++ b/bindings/python/monome.pyx
@@ -115,6 +115,8 @@ all = [
"Monome"]
+BUTTON_UP, BUTTON_DOWN, ENCODER_DELTA, ENCODER_KEY_UP, ENCODER_KEY_DOWN, TILT = range(6)
+CABLE_LEFT, CABLE_BOTTOM, CABLE_RIGHT, CABLE_TOP = range(4)
MODE_NORMAL = 0
MODE_TEST = 1
@@ -155,15 +157,12 @@ def _bitmap_data(data):
cdef class MonomeEvent(object):
cdef object monome
- def __cinit__(self, object monome):
- self.monome = monome
-
cdef class MonomeGridEvent(MonomeEvent):
cdef uint x, y
cdef bool pressed
def __cinit__(self, pressed, uint x, uint y, object monome):
- MonomeEvent.__cinit__(monome)
+ self.monome = monome
self.pressed = bool(pressed)
self.x = x
self.y = y
yeah i'm cool with this. it would be nice to handle all common stuff in MonomeEvent but Cython sometimes doesn't want to play nice.
could you submit this as a pull request?
Cool. I submitted a pull request... best regards Alex
Hi,
I have problems with using the python bindings. When registering for events, the code below will tell me as soon as a button is pressed:
Exception TypeError: '__cinit__() takes exactly 1 positional argument (4 given)' in 'monome.handler_thunk' ignored
I tried to debug the code myself, but could not find any obvious error. I also tried to compile with the most recent cython version, however, this would not resolve the issue.
BTW, I added the following lines to the monome.pyx:
Here is a sligthly modified version of simple.py that I tried to use.
Thanks in advance Alex