Skip to main content

Creative coding in Python

Project description


p5 is a Python library that provides high level drawing functionality
to help you quickly create simulations and interactive art using
Python. It combines the core ideas of `Processing
<>`_ — learning to code in a visual context —
with Python's readability to make programming more accessible to
beginners, educators, and artists.


.. image::

p5 programs are called "sketches" and are run as any other Python
program. The sketch above, for instance, draws a circle at the mouse
location that gets a random reddish color when the mouse is pressed
and is white otherwise; the size of the circle is chosen randomly. The
Python code for the sketch looks like:

.. code:: python

from p5 import *

def setup():
size(640, 360)

def draw():
if mouse_is_pressed:
fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
fill(255, 15)

circle_size = random_uniform(low=10, high=80)

circle((mouse_x, mouse_y), circle_size)

def key_pressed(event):


The p5py documentation can be found here `p5 documentation


Take a look at the installation steps here in the `p5 documentation


p5 is licensed under the GPLv3. See `LICENSE <LICENSE>`_ for more
details. p5 also includes the following components from other open
source projects:

- OpenGL shaders `from the Processing
project. Licensed under LGPL v2.1. See `LICENSES/lgpl-2.1.txt
<LICENSES/lgpl-2.1.txt>`_ for the full license text.

All licenses for these external components are available in the
``LICENSES`` folder.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
p5-0.5.0-py3-none-any.whl (55.8 kB) Copy SHA256 hash SHA256 Wheel py3
p5-0.5.0.tar.gz (39.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page