Turtle Graphics Cheatsheet
 Share
The version of the browser you are using is no longer supported. Please upgrade to a supported browser.Dismiss

View only
 
 
ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
Turtle Graphics Cheatsheet
2
3
Turtle Pen
4
turtle.pen(pencolor=”red”, pensize=10, fillcolor=”black”)Pens have attributes such as color, size, and fillcolor.
5
turtle.up()Sets the pen state to be up (not drawing).
6
turtle.down()Sets the pen state to be down (drawing).
7
turtle.color(r,g,b)See below
8
turtle.color(s)Sets the color that the pen will draw until the color is changed. It takes either 1) three arguments, each a floating point number between 0.0 — 1.0, where the first the amount of red, the second is the amount of green, and the third is the amount of blue, or 2) a “color string” the name of a TK color (e.g., “black”, “red”, “blue”, ...)
9
turtle.begin_fill()See below
10
turtle.end_fill()To fill a figure, use turtle.begin_fill() before you start drawing the figure. Draw the figure. Then execute turtle.end_fill(). The figure drawn between the two fill commands will be filled with the present color setting.
11
turtle.hideturtle()See below
12
turtle.showturtle()Sets the state to hide / show the turtle. When shown, you see it as a small arrowhead pointed in the direction of the heading.
13
turtle.fill(True)To fill a figure, use turtle.fill(True) before you start drawing the figure. The figure drawn will be filled with the present color setting.
14
Turtle Draw
15
turtle.right(degrees)Turns the direction that the turtle is facing right (clockwise) by the amount indicated (in degrees).
16
turtle.left(degrees)Turns the direction that the turtle is facing left (counterclockwise) by the amount indicated (in degrees).
17
turtle.forward(distance)Moves the turtle forward (in the direction the turtle is facing) the distance indicated (in pixels). Draws a line if the pen is down, not if the pen is up.
18
turtle.backward(distance)Moves the turtle backward (in the direction opposite to how the turtle is facing) the distance indicated (in pixels). Draws a line if the pen is down, not if the pen is up.
19
turtle.setheading(angle)Sets the orientation of the turtle to angle. Here are some common directions in degrees: 0 (east) 90 (north) 180 (west) 270 (south)
20
turtle.goto(x,y)Moves the turtle to the specified coordinates, drawing a straight line to the destination (x,y) if the pen is down, and not drawing if the pen is up.
21
turtle.circle(radius)Draws a circle of the indicated radius. The turtle draws the circle tangent to the direction the turtle is facing.
22
Turtle other
23
turtle.xcor(),turtle.ycor()Returns the x - coordinate / y - coordinate of the current pen position.
24
x, y = turtle.pos() Sets the variables x and y to the turtle’s current position
25
turtle.exitonclick() or turtle.done()To prevent the screen from closing.
26
turtle.bye()Close the turtle drawing window
27
turtle.speed(integer)Set the animation speed of the turtle. 1 = slowest, 10 = fastest. 0 turns off animation completely
28
turtle.shape('turtle')Set the shape. You can also choose from arrow, square, circle, triangle and classic
29
30
Compiled from:http://bit.ly/2J8Cj77
31
http://bit.ly/2kr4tMN
32
http://bit.ly/2krp7MJ
33
Google Sheet:http://bit.ly/2JbSiSg
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Loading...
Main menu