Hi, can someone help me,
I’m using jython (loadbang.net) with maxmsp and I try to use maxmsp class in jython. But I can’t instantiate a class
Here is what i do:
test = com.cycling74.max.MaxObject() # or
test = com.cycling74.max.MaxObject.getInstance()
and max message box returns me this error:
TypeError: No visible constructors for class (com.cycling74.max.MaxObject)
Did you study the "jython.BasicUsage.mxt" patch that’s included with the distribution? I’m not hugely familiar with how it handles the MaxObject, but I don’t think you need to import or construct a reference to it to throw something down an outlet.
hi, thanks for your reply, yes I studied it and used it greatly so far.
But for my project need, it would be so handy for me to use this function (and other functions) within a class that is called by the main script.
I posted another message just after this one that explains that, can you have a look at it?
You can’t instantiate a MaxObject because it’s abstract. In practice, the MXJ machinery builds a MaxObject instance for you (which, if working in Java, you sub-class) and links it into Max via JNI – you can’t just create them dynamically.
In the Jython system I make the owning MaxObject instance available in the Python namespace as "maxObject" – you’ll need to pass this around, or wrap another object around it, in order to do output.