Python mode "immediate" processing?

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?

1 Like

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

1 Like

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

There is a REPL mode in the Processing IDE; I have no idea how to use it.

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.

1 Like