We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello! I am using Processing in Python mode and I am trying to set up a function to send/receive OSC messages. Is there an example somewhere ? I am trying to convert the Java syntax into Python but I am wondering if the library works at all in Python mode. Please advise!
Answers
https://forum.Processing.org/two/discussions/tagged/jython
Sorry but I couldn't find any reference to oscP5 in your reply. am I missing something?
Maybe you've missed the fact that Python Mode is based on Jython?
And thus it can use any Java library. And Processing itself is a Java library too!
I understand that, thank you. But about using oscP5: I am trying to refer to the examples but I am not sure what to change and how to make the java code work in python mode. For instance do I need the 'this' variable? In general is there some example about it? thank you for your help!
Chances are very slim to find any specific Python Mode library examples. :(
Python Mode got some when we hit CTRL+SHIFT+O @ "Contributed Libraries in Python" though.
You should post your attempts. Trying to get help only by words hardly works!
However, I barely know any Python. But who knows some1 else might show up? :-\"
In Java,
this
isn't a mere variable but a language keyword. Just likewhile
,return
,float
, etc.Python doesn't have an "official" keyword for
this
.But in Python, by convention, the 1st parameter in all methods is named self. And it acts as 1.
However, we can choose any other name if we'd like to piss pythonists off! >:)
P.S.: Seems like Python Mode already declares a variable called this to represent the current sketch. ~O)
Ok, got it. Here is my attempt at covering one of the oscP5 examples (oscP5sendReceive.pde) into Python. Of course it doesn't work. The 'this' keyword is clearly wrong. 'self' does not work though. I would love to hear someone who has gone through this, even though it seems that processing in python doesn't have a lot of fans...
Please re-edit your last post in order to properly format your code for the forum here:
https://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text
My guess is that most folks who use other Processing spin-offs are taught in school.
And hardly come here for any help! 8-|
This is just my poor attempt to improve your attempt. I dunno Python after all: :(|)
Thank you. Unfortunately it doesn't work. :-S I do think that the 'this' keyword is an issue.
my bad! it does work. I still need to figure out how and why but this is a good starting point. Thanks so much!
https://GitHub.com/jdf/processing.py/issues/170