I’m trying to learn Processing from “Math Adventures with Python” . The author shows a function that returns a number running from a command line (>>>). How does one access a command environment line from Processing?
Processing has a console area at the bottom of its IDE which we can print
to it, but no direct typing.
Instead we type in our code text on the PDE’s window area.
Use command print
in order to output the result of an expression onto the bottom console area.
As an example, running the following Python Mode code below:
print 23 + 56 - 4
print 3 ** 5
print PI, TAU
exit()
will output these values onto the console area:
75
243
3.14159274101 6.28318548203
To complement what GoToLoop mentioned (the Processing Python mode inside of the Processing IDE has no “interactive console”, you may see it called REPL sometimes).
You might want to try other Python environments to get the immediate feedback… but it can’t be done in Processing Python mode.
Thanks guys, I suspected as much. I think the author was running
the code in python from the command window.
Se vc ver algo tipo: >>> 10 + 20
No Python Mode vc converte para: print 10 + 20
I believe REPL Mode is for Java syntax only.
For Python Mode you’re gonna need to rely on print
statements.
Or install Python in your OS:
Yep, I have Python installed and can run it in my CMD window. I just wish the author had been more clear on how he did it, because
I do like his book. It’s why I installed Processing.