Practical Coding in Python

Learn to write and validate your own code

Darren Kessner, PhD

(revised September 1, 2025)

Previous: Hello, Juypter Lab!

Hello py5

py5 is Processing for Python.
https://py5coding.org/

This is the “module” mode hello program.

Information about the different py5 modes here:
https://py5coding.org/content/py5_modes.html

#
# hello_py5.py
#

import py5

def setup():
    py5.size(300, 200)
    py5.rect_mode(py5.CENTER)

def draw():
    py5.rect(py5.mouse_x, py5.mouse_y, 10, 10)

py5.run_sketch()