jupyturtle
Python Turtle graphics for Jupyter notebooks
For a quick demo, open the lab notebook.
To use on a live Jupyter Notebook,
just download the jupyter.py file to the same folder where your notebook is saved,
and import it.
Credits
The idea and some of the code for this module came from Tolga Atam's ColabTurtle, which I discovered reading a pre-print version of Allen Downey's book Think Python, Third Edition (O'Reilly, 2024).
Design
Atam's best idea was to use SVG for drawing, which makes the code simple and lightweight,
requiring only the Python standard library and the
ipython module that is always available in Jupyter.
This is a rewrite from scratch, using classes to model the turtle and the drawing. My goal was to make it easier to understand and extend by encapsulating the state.
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.
Turtle on a canvas
jupyturtle2 is a fork
that uses
ipycanvas
to draw pixels on an HTML canvas, instead of generating SVG,
so it handles complex drawings better.
But jupyturtle2 has two main drawbacks:
-
ipycanvasrequires the binary dependenciesnumpyandpillow, which may be harder to install in some environments. -
the generated drawings are not saved with the notebook like most other output cells; this is also a limitation of
ipycanvas
Metadata
Release files for jupyturtle 2024.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jupyturtle-2024.4.1.tar.gz | 141.5 kB | Without provenance | Details for jupyturtle-2024.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jupyturtle-2024.4.1-py3-none-any.whl | Python 3 | none | any | Details for jupyturtle-2024.4.1-py3-none-any.whl |
Total release size: 149.0 kB
Release files / jupyturtle-2024.4.1.tar.gz
| Download URL | jupyturtle-2024.4.1.tar.gz |
|---|---|
| Size | 141.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4c1b5d71056189a9b7abbd68b37418c696ea313e19e09a67ea537f9753a2a5f4
|
|
BLAKE2b-256 checksum How to use checksums |
dbb9ff1bd96dca39d917e6d52a7afc922e4453a2bc0ec6d681e348448f4d9e2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / jupyturtle-2024.4.1-py3-none-any.whl
| Download URL | jupyturtle-2024.4.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf840574c85805155bea350e628b98befa659ce6293f7b63054d48da2e2891c2
|
|
BLAKE2b-256 checksum How to use checksums |
7128f8a8e821cae0e876193f1295d9b07db9e0f9d62faa2cd645ab248a35df92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for jupyturtle 2024.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.