Show Menu
Cheatography

Python Turtle Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

PYTHON

Python is mages are shown as thumbnails on the HTML cheat sheets and can be clicked on to zoom in. On the PDF version, they only appear as thumbn­ails.

Turtle Commands

import turtle
from turtle import*
turtle.shape("turtle, triangle, square, circle")
turtle.color("red, blue, green")
pensize(N)
pencolor("C")
turtle.left(D)
turtle.right(D)
turtle.forward(N) 
turtle.circle(R)
turtle.circle(R,D)
penup() or pu()
turtle.goto(x,y)
pendown() or pd()

F5 - Run the program
filename.py   (filename extension)

Draw Polygon
for i in range(N)
     turtle.forward(N)
     turtle.right(N)         (N=360/no of sides)

Fill in color to shape
turtle.begin_fill()
turtle.fillcolor(C) 
turtle.end_fill()
 

Turtle Style

turtle.sh­ape­("tu­rtle, square, triangle, circle­")
change turtle shape
turtle.co­lor­(r,g,b)
set turtle color