Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

---

p5

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.

Example

https://github.com/p5py/p5/blob/develop/docs/_static/readme.gif

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:

from p5 import *

def setup():
    size(640, 360)
    no_stroke()
    background(204)

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

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

    circle((mouse_x, mouse_y), circle_size)

def key_pressed(event):
    background(204)

run()

Installation

p5 requires Python 3 to run. Once you have the correct version of Python installed, you can run:

$ pip install numpy
$ pip install p5 --user

to install p5.

Features Roadmap

Our end goal is to create a Processing-like API for Python. However, instead of being a strict port of the original Processing API, we will also try to extend it and use Python’s goodness whenever we can.

For now, though, we plan to focus on the following features:

  1. Support most 2D drawing primitives and related utility functions from the Processing API (as of the latest release, this is almost done).

  2. Support other parts of the Processing API: images, fonts, etc.

  3. Port relevant tutorials and reference material from Processing’s documentation.

  4. Support live coding of sketches in the Python REPL (here’s a screencast from an earlier prototype).

License

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

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

---

Download files

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

Source Distribution

p5-0.3.0a2.tar.gz (60.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

p5-0.3.0a2-py3.6.egg (205.3 kB view details)

Uploaded Egg

p5-0.3.0a2-py3-none-any.whl (97.0 kB view details)

Uploaded Python 3

File details

Details for the file p5-0.3.0a2.tar.gz.

File metadata

  • Download URL: p5-0.3.0a2.tar.gz
  • Upload date:
  • Size: 60.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for p5-0.3.0a2.tar.gz
Algorithm Hash digest
SHA256 ba1556a951aec04481d091c90ec0b0df381a2fc40a5e1ffdc72929a02bda1db4
MD5 5e733c6daa16c95407a5bb08e93a8284
BLAKE2b-256 3bfd16ab17979a0c47a46d45a76d2821de512fdcccf686c0ca63b142b362ef64

See more details on using hashes here.

File details

Details for the file p5-0.3.0a2-py3.6.egg.

File metadata

  • Download URL: p5-0.3.0a2-py3.6.egg
  • Upload date:
  • Size: 205.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for p5-0.3.0a2-py3.6.egg
Algorithm Hash digest
SHA256 4f6eb4b6cb8e3fe8385b6e6a6ce3a9b2abbf1486b3f5670c801c3792f6e8c315
MD5 33972ef93047a588858601bb160bbd2c
BLAKE2b-256 80a02dc705e46097f7ffba88510e253dc6b61924236f7506485c9271b1442ef5

See more details on using hashes here.

File details

Details for the file p5-0.3.0a2-py3-none-any.whl.

File metadata

  • Download URL: p5-0.3.0a2-py3-none-any.whl
  • Upload date:
  • Size: 97.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for p5-0.3.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 59c325d63e444d95a01b669f3fd572ad002c1ce2707e0f1c0809dcb535d33e42
MD5 7406bdb2d293816dfd42e07a3728f7de
BLAKE2b-256 06964eef62742372f7591656f53c4c9ffcb5673274e32786dbc71d3264576c35

See more details on using hashes here.

Release history Release notifications | RSS feed

0.9.0

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

This release

0.3.0a2 This release

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page