Interactive widgets library exposing the browser's Canvas API


Keywords
Jupyter, Widgets, IPython, canvas, canvas2d, interactive-visualizations, jupyterlab
License
BSD-3-Clause
Install
pip install ipycanvas==0.8.2

Documentation

ipycanvas

Documentation Binder Build Status

Interactive Canvas in Jupyter.

ipycanvas is an Interactive widgets library exposing the browser's Canvas API to Python. It allows you to draw simple primitives directly from Python like text, lines, polygons, arcs, images etc.

Try it online!

You can try it online by clicking on this badge:

Binder

Documentation

You can read the documentation following this link: https://ipycanvas.readthedocs.io/en/latest/

Examples

Create John Conway's Game Of Life

John Conway's Game Of Life

Draw Particles from IPython

Particles

Custom Sprites

Sprites

Draw data directly from a NumPy array

NumPy

Installation

You can install using pip:

pip install ipycanvas

Or using conda:

conda install -c conda-forge ipycanvas

And if you use jupyterlab:

jupyter labextension install @jupyter-widgets/jupyterlab-manager ipycanvas

If you are using Jupyter Notebook 5.2 or earlier, you may also need to enable the nbextension:

jupyter nbextension enable --py [--sys-prefix|--user|--system] ipycanvas

Installation from sources

You can install using pip:

git clone https://github.com/martinRenou/ipycanvas
cd ipycanvas
pip install .

And if you use jupyterlab:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install .

And you use the classical Jupyter:

jupyter nbextension install --py --symlink --sys-prefix ipycanvas
jupyter nbextension enable --py --sys-prefix ipycanvas