Skip to main content

Helper Class for Using p5.js with PyScript.

Project description

P5Canvas Helper Class

概要

P5Canvasはp5.jsをPyScript(ブラウザ上で動くPython)で使うためのヘルパーライブラリです。

使い方

import P5Canvas

class MyCanvas(P5Canvas):
    def setup(self, p5):
        self.x = 100
        self.y = 100
        p5.createCanvas(300, 300)

    def draw(self, p5):
        p5.background(128)
        p5.fill(255, 0, 0)
        p5.ellipse(self.x, self.y, 50, 50)

        if p5.keyIsDown(p5.LEFT_ARROW):
            self.x -= 1
        if p5.keyIsDown(p5.RIGHT_ARROW):
            self.x += 1
        if p5.keyIsDown(p5.UP_ARROW):
            self.y -= 1
        if p5.keyIsDown(p5.DOWN_ARROW):
            self.y += 1

MyCanvas().run()

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

p5canvas-1.0.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

P5Canvas-1.0.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file p5canvas-1.0.0.tar.gz.

File metadata

  • Download URL: p5canvas-1.0.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for p5canvas-1.0.0.tar.gz
Algorithm Hash digest
SHA256 64e072983a136e2c4dfea2538e0fc1471162b282fb4446b553b2fa562e72588d
MD5 0e1554aeb02fd5312acbf5bb00bf32f2
BLAKE2b-256 7da615c4d7a7d9344898c04b638a054d844c6e1c19bd7dfa15d38b5b791db2cf

See more details on using hashes here.

File details

Details for the file P5Canvas-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: P5Canvas-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for P5Canvas-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2416d5826b1932826b2cb434d7f72d70a2fea52cf6d987069c0d9ccb4f533759
MD5 24275ccb0628a7808c495c39a848f1e3
BLAKE2b-256 3e2479fc9088e46d13333622292d8b8f8a1799a4d09d1516604665a7829f0aed

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