Skip to main content

Turtles using IPython Display

Project description

IPythonDisplayTurtle

An implementation of the classic turtle module mainly implemented 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.

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.goforward(300/divisions)
    t.turnright(angle)
t.penup()
t.goforward(120)
t.turnright(360)

t.display()

Example Turtle

Binder

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

IPythonDisplayTurtle-0.0.9.tar.gz (91.2 kB view hashes)

Uploaded Source

Built Distribution

IPythonDisplayTurtle-0.0.9-py3-none-any.whl (93.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page