Installing Processing 4 and Python Mode
the official Processing website says that Python Mode is not maintained and does not recommend using it in Processing 4. It works for simple drawing and animation, but libraries (the serial connection for the micro:bit, sound) often do not work. For new work use Thonny + py5; use this lesson if you already have old sketches.
the examples in this lesson are written for Processing Python Mode. If you work in the recommended environment Thonny + py5, most of the code stays the same, and names with a capital letter in the middle are written in lower case with an underscore:
mouseX → mouse_x, noStroke() → no_stroke(). See the table of differences.Why do we use Processing 4?
In this course we use Processing 4 because it is one of the simplest environments for learning graphics programming.
- a free and open tool
- easy to install
- an ideal environment for graphics, animation and interaction
- often used in education and creative coding
If you have already done the lessons from the section Processing with Java, you will notice that the environment is exactly the same. The only difference is that now we use Python instead of the Java language.
A first look at the Processing IDE
When you start Processing, you will see a simple programming interface.
- Editor – where you write code
- the Run button ▶ – starts the program
- the Stop button ■ – stops the program
- Console – shows messages and errors
Processing is made so that a program can be started with one click, which makes it ideal for beginners.
Step 1: Downloading Processing 4
Visit the official website and download the version for your operating system:
https://processing.org/download
After downloading:
- Windows: unpack the ZIP file and run
processing.exe - Mac: drag the application into the Applications folder
- Linux: unpack the archive and run the script
Processing does not need a classic installation — it works straight after unpacking.
Step 2: Installing Python Mode
By default Processing uses the Java language. To write programs in Python you need to install Python Mode.
- Start Processing.
- In the menu choose Tools → Manage Modes.
- Find Python Mode.
- Click Install.
After installing, change the mode in the top right corner from Java to Python.
Checking the installation
Create a new sketch and type the following code:
def setup():
size(500, 300)
def draw():
background(220)
Click the ▶ Run button. If a window with a grey background appears, the installation was successful.
Change the size of the window:
size(800, 400)
Run the program again and watch the change.
Experimenting is the fastest way to learn how Processing works.
Organising projects
Every Processing project is kept in a separate folder called a sketch.
It is good practice to make a separate folder for all the projects from this course.
- make a folder PythonProcessing
- keep all the projects in it
- every project has its own folder
For example:
PythonProcessing/ first_sketch/ ball_animation/ pong/
Other options
Recommended: py5 in Thonny
- real Python 3 and all Python libraries (for example
pyserialfor the micro:bit) - the Thonny plug-in downloads Java by itself – no manual setup
- instructions: py5 in Thonny
Processing with Java
- a stable and maintained environment; the same ideas (setup, draw), a different syntax
- instructions: Java and Processing – an introduction
The most common mistakes
- the mode was not changed from Java to Python
- Python Mode is not installed
- a mistake in the indentation of the code
If you have problems with Python syntax, see the lesson: Python — the basics of the syntax.
Related topics
- Processing with Java — installation
- MicroPython and Processing — communication
- An introduction to Python Processing
Check your knowledge
Open the quiz
Mini quiz: the environment
1. Which language does Processing Python Mode use?
2. Which environment does the course recommend for projects with the micro:bit?
