Skip to main content

A library that allows users to interact with the HTML Canvas with 100% Python + HTML.

Project description

pywebcanvas

pywebcanvas is a library that allows users to interact with the HTML Canvas with 100% Python + HTML.

Getting Started

Just add the following to an html file and you are ready to go!

Between the head tags, add pyscript and pywebcanvas:

<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" />                                                         
<script defer src="https://pyscript.net/alpha/pyscript.js"></script>
<py-env>
  - pywebcanvas
</py-env>

In the body, you can customize the following:

<py-script>
import pywebcanvas as pwc                                                                                                            

canvas = pwc.Canvas(800, 600)                                                                                                        
canvas.background.fill("blue")                                                                                                       
text = pwc.Text(text="Hello World from pywebcanvas!", x=100, y=100, size=25, color="yellow")                                         
canvas.render(text)
</py-script>

Documentation

Checkout the following to learn how to use this project:

Credits

This project is made possible by the developers of pyscript, pyodide, and many others. Licensed under LGPL-3.0-or-later Copyright (C) 2022 Isaac Beverly

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

pywebcanvas-0.3.0.tar.gz (6.2 kB view hashes)

Uploaded source

Built Distribution

pywebcanvas-0.3.0-py3-none-any.whl (8.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page