Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.26 KB

README.md

File metadata and controls

45 lines (33 loc) · 1.26 KB

WIP

Please note that this is still being actively developed, hence may not work properly for you!

Also see: https://github.com/atahan-git/SSSsnake

IPythonDisplayTurtle

An implementation of the classic turtle module mainly created using IPython.display, IPython.HTML, and paperscript. Can be used with Jupyter Notebooks, and in places where ipywidgets are not supported. Only requires one way communication to work, so great for remote server cases. Also has level drawing capabilities. You can check the source code yourself for more info!

How to install from a terminal/command prompt:

pip install IPythonDisplayTurtle

To install from a jupyter notebook cell:

!pip install IPythonDisplayTurtle

How to use:

from IPythonDisplayTurtle import Snake

colours=["red","orange","yellow","green","blue","purple"]
divisions = 12
angle = 360/divisions 

t = Snake(_pendown = 0)
for i in range(divisions):
    if(i%2 == 0):
        t.pendown()
        t.pencolor(colours[int(i/2)%len(colours)])
    else:
        t.penup()
    t.forward(300/divisions)
    t.right(angle)
t.penup()
t.forward(120)
t.right(360)

t.display()

Example Turtle

Binder