Coder Social home page Coder Social logo

py5examples's Introduction

py5 Examples

py5 logo

Binder

py5 downloads

Downloads

py5 is a new version of Processing for Python 3.8+. It makes the Java Processing jars available to the CPython interpreter using JPype. It can do just about all of the 2D and 3D drawing Processing can do, except with Python instead of Java code.

The goal of py5 is to create a new version of Processing that is integrated into the Python ecosystem. Built into the library are thoughtful choices about how to best get py5 to work with other popular Python libraries and tools such as Jupyter, numpy, and Pillow.

Here is a simple example of a working py5 Sketch, written in module mode:

import py5


def setup():
    py5.size(200, 200)
    py5.rect_mode(py5.CENTER)


def draw():
    py5.square(py5.mouse_x, py5.mouse_y, 10)


py5.run_sketch()

If you have Java 11 installed on your computer, you can install py5 using pip:

pip install py5

Detailed installation instructions are available on the documentation website. There are some Special Notes for Mac Users that you should read if you use OSX.

There are currently four basic ways to use py5. They are:

  • module mode, as shown above
  • class mode: create a Python class inherited from py5.Sketch, and support multiple Sketches running at the same time.
  • imported mode: simplified code that omits the py5. prefix. This mode is supported by the py5 Jupyter notebook kernel and the run_sketch command line utility.
  • static mode: functionless code to create static images. This mode is supported by the py5bot Jupyter notebook kernel and the %%py5bot IPython magic.

py5generator is a meta-programming project that creates the py5 library. To view the actual installed py5 library code, look at the py5 repository. All py5 library development is done through py5generator.

The documentation website, https://py5coding.org/, is very much a work in progress. The reference documentation is solid but the how-to's and tutorials need a lot of work.

py5examples's People

Contributors

hx2a avatar villares avatar yuvipanda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.