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.
To report a bug / make a feature request use the issues page in this repository. You can also use the discourse platform to ask/discuss anything related to p5py.
Example
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)
# p5 supports different backends to render sketches,
# "vispy" for both 2D and 3D sketches & "skia" for 2D sketches
# use "skia" for better 2D experience
# Default renderer is set to "vispy"
run(renderer="vispy") # "skia" is still in beta
Documentation
The p5py documentation can be found here p5 documentation
Installation
Take a look at the installation steps here in the p5 installation page
Contributing
We welcome contributions from anyone, even if you are new to open source. You can start by fixing the existing issues in p5py. In case you need any help or support from the p5py development community, you can join our slack group.
License
p5 is licensed under the GPLv3. See 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 for the full license text.
All licenses for these external components are available in the LICENSES folder.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file p5-0.8.4.tar.gz
.
File metadata
- Download URL: p5-0.8.4.tar.gz
- Upload date:
- Size: 113.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ec639a16608c99d6bc857003b4f13bb5baeec220976a66e621997b24c308d7d |
|
MD5 | e2f2d3aa04d913e1925d09a453d369ae |
|
BLAKE2b-256 | 59c82faea290f794963de215a3399f8bf9082ef09a92ac00ee757739b2a60cec |
File details
Details for the file p5-0.8.4-py3-none-any.whl
.
File metadata
- Download URL: p5-0.8.4-py3-none-any.whl
- Upload date:
- Size: 145.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79a036fb81de27ede4e5e135f5a5188ee10e624a1f1af70b67fc1c1582b83730 |
|
MD5 | 168a60462b7ad62be2f658bfa35fd480 |
|
BLAKE2b-256 | 7342b50f1f08400d822c72283221c865f7d433e5edf3c81aa8e57a895463ecaf |