Skip to main content

Creative coding in Python

Project description

License Version Slack SanityTests Pylint Pytest

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

https://github.com/p5py/p5/raw/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()

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:

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.

Source Distribution

p5-0.8.0.tar.gz (105.3 kB view details)

Uploaded Source

Built Distribution

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

p5-0.8.0-py3-none-any.whl (136.4 kB view details)

Uploaded Python 3

File details

Details for the file p5-0.8.0.tar.gz.

File metadata

  • Download URL: p5-0.8.0.tar.gz
  • Upload date:
  • Size: 105.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for p5-0.8.0.tar.gz
Algorithm Hash digest
SHA256 c429e1d037411ee7fb9bb3d65537d4d939d54f2a2aa68915ac515c9f84101ee5
MD5 2b489213a131269fa00a9df3da5b1936
BLAKE2b-256 4f5b36b42dbf4859008a8a5dcc927e09e22d9218cc488bcf8c2e3c380f4a61b1

See more details on using hashes here.

File details

Details for the file p5-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: p5-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 136.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for p5-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb0f04322093e6154961172692ce174d4bea3349169e11739583f54fce2e41dc
MD5 40d194f411ea5788de2429f335af5944
BLAKE2b-256 f50166f2438e36a62dcd511115a0b9b2c3bf9935d100b0febbda6123c7d853ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page