Python Turtle graphics for Jupyter notebooks
For a quick demo, open the lab notebook.
jupyturtle2
is a fork of jupyturtle
replacing SVG output with rendering on an ipycanvas
widget.
It solves the problem of rendering SVG drawings that grow increasingly slow as lines are added.
But ipycanvas
introduces two other problems:
- A limited number of steps per second, which requires using
delay=0.01
for complex drawings. - The final state of the canvases is not saved with the notebook.
I used metaprogramming techniques to build the procedural API
with global functions like fd()
to move the turtle.
The techniques are easier to understand in the didactic project
abacus.
@ramalho