Turtle graphics based on ipycanvas which can run on jupyter lab/notebook/vscode.
Project description
Demo
Turtle graphics based on ipycanvas which can run on jupyter lab/notebook/vscode.
https://github.com/williamnavaraj/ipyturtle3/blob/main/Images/TurtleWin.gif
Usage: Installation
pip install ipyturtle3
Example ipynb code. Run this in a cell.
import ipyturtle3 as turtle
from ipyturtle3 import hold_canvas
myCanvas=turtle.Canvas(width=500,height=250)
display(myCanvas)
myTS=turtle.TurtleScreen(myCanvas)
myTS.clear()
myTS.bgcolor("lightgreen")
bob=turtle.Turtle(myTS)
jess=turtle.Turtle(myTS,isHolonomic=True)
jess.shape("square")
bob.shape("turtle")
myTS.delay(200)
# Usual turtle Non-holonomic example
bob.forward(50)
bob.left(90)
bob.forward(50)
bob.left(90)
bob.forward(50)
bob.left(90)
bob.forward(50)
#Holonomic
jess.moveleft(200)
jess.moveup(100)
jess.moveright(100)
jess.movedown(100)
jess.turnright(45)
jess.turn(-45)
jess.distance_at_angle(50,45)
myTS.clear()
# Rainbow benzene
colors = ['red', 'purple', 'blue', 'green', 'orange', 'yellow']
t = turtle.Turtle(myTS)
myTS.bgcolor('black')
for x in range(50):
with(hold_canvas(myCanvas)):
t.pencolor(colors[x%6])
t.width(x//100 + 1)
t.forward(x)
t.left(59)
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
ipyturtle3-0.1.4.tar.gz
(6.2 kB
view details)
Built Distribution
File details
Details for the file ipyturtle3-0.1.4.tar.gz
.
File metadata
- Download URL: ipyturtle3-0.1.4.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.11.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82a180ffad757e8671a6e0d119d06167388b9d163a33a037ffcfb7771cdf65f4 |
|
MD5 | 5b00510bab0962f9397b355e5f7086f5 |
|
BLAKE2b-256 | 8992b0f716742ea285e63d9ea6d31a3003ec805e488890dba3e1fb849d5767df |
File details
Details for the file ipyturtle3-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: ipyturtle3-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.11.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac02d1fa065c24ec99555ef00ce602114f1ae0f0cb6dc8e5094a73ba035d5d7c |
|
MD5 | 37931ecd4859fbb298f36353d3f700e6 |
|
BLAKE2b-256 | 20017165219ab45c09317dcfa924f5971fd664febe44f87b0cddffef048606f8 |