I’m curious about why keyCode doesn’t seem to recognise keypresses when you import processing using an alias. I am using trinket, so that may be an issue.
With this simple code
from processing import *
I can derive the keyCode value for any key I press. But if I change the import style:
import processing as p
the code runs but it prints the word unknown surrounded by less than and greater than signs
whatever key I press.
Grateful for enlightenment.
The Trinket implementation of Processing + Python is based on Skulpt + ProcessingJS
Maybe you could try
pyp5js: drawing with Python 3 | pyp5js which is a work in progress, but at least you can open an issue if it doesn’t work…
And there are other options to explore, like
http://p5py.com (Brython based)
More options at Python + Processing table
Hi thanks for the information.
Do you know if there is a way to use the processing library with Python Idle? If I
import processing it says ‘No module named processing’ so I suppose it needs installing, but using
pip install processing doesn’t work. Do I need a different install command?
Processing is a Java library; hence it’s not available via
pip. You could use
py5 instead (
pip install py5). Note that you’ll need to have
Java installed on your computer.
@tabreturn and me, we are fans of py5.ixora.io
PyScript alpha version was recently released and I’ve converted an online sketch for it:
Python is now a full browser client language w/ PyScript:
So again I couldn’t resist converting my previous RapydScript sketch “Self Avoiding Walk II” to PyScript.
I’ve also added Python type hints to the whole code:
All 3 JS Processing flavors run on PyScript just like CoffeeScript & RapydScript previous versions:
click here to download the full sketch so you can edit & run it somewhere else.
And go to the link below to view it fullscreen: