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.0a1.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.0a1-py3.6.egg (109.4 kB view details)

Uploaded Egg

p5-0.3.0a1-py3.5.egg (111.0 kB view details)

Uploaded Egg

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for p5-0.3.0a1.tar.gz
Algorithm Hash digest
SHA256 e1e686d0b0e375c59623568208a87f69d8c2a001277d8d1a48ae1d74c3abb511
MD5 e444f85dd86947a9d5ea1edf18583a10
BLAKE2b-256 0fad57692b26a0adbb7cf35335c5e5982e24385ea022a6c172a8e6569c916f48

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for p5-0.3.0a1-py3.6.egg
Algorithm Hash digest
SHA256 41b60bedf7e07f8ea802695d4fb81a4b6fed20cf88d86e56411f4c7ad9e9704a
MD5 ad13d0c4dc89e315f2aa0cf418939f0b
BLAKE2b-256 3a7597b252d51b1027b9370b5aac85bd4ec66a25af9c2c08a0f415e5fac6f588

See more details on using hashes here.

File details

Details for the file p5-0.3.0a1-py3.5.egg.

File metadata

  • Download URL: p5-0.3.0a1-py3.5.egg
  • Upload date:
  • Size: 111.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for p5-0.3.0a1-py3.5.egg
Algorithm Hash digest
SHA256 1173bc107170ad737b0e282d75ea6e97523f271d77064798c4af3677e303dda5
MD5 f091b171f026f6a164f9e8aedcad3add
BLAKE2b-256 5d3c2a3827e8d916e703fa0088387acbdca0c7b693d011640f502941e520b145

See more details on using hashes here.

File details

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

File metadata

  • Download URL: p5-0.3.0a1-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.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf1615de5e00f7785c143119c4709180b673df1bf2fda77811a7ab8c7a0e722
MD5 1df3e42fc369fcd347138ad99d49eb90
BLAKE2b-256 ec0572faefb0339a86e3ab0dcf1a80f0c225ad59df3c4132efa81bc9c45aa273

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.0a1 This release

4 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