|
Method |
Parameter |
Description |
|---|---|---|
|
Turtle() |
None |
Creates and returns a new turtle object |
|
forward() |
amount |
Moves the Turtle forward by the specified amount |
|
backward() |
amount |
Moves the Turtle backward by the specified amount |
|
right() |
angle |
Turns the Turtle clockwise |
|
left() |
angle |
Turns the Turtle counter clockwise |
|
penup() |
None |
Picks up the Turtle’s Pen |
|
pendown() |
None |
Puts down the Turtle’s Pen |
|
up() |
None |
Picks up the Turtle’s Pen |
|
down() |
None |
Puts down the Turtle’s Pen |
|
color() |
Color name |
Changes the color of the Turtle’s pen |
|
fillcolor() |
Color name |
Changes the color of the Turtle will use to fill a polygon |
|
fillcolor(r,g,b) |
R,g,b values |
Changes the color of the Turtle will use to fill a polygon with r,g,b colors |
|
heading() |
None |
Returns the current heading |
|
setheading() |
angle |
Turn the Turtle in this direction (right = 0, up = 90, etc) |
|
position() |
None |
Returns the current position |
|
goto() |
x, y |
Move the Turtle to position x,y |
|
begin_fill() |
None |
Remember the starting point for a filled polygon |
|
end_fill() |
None |
Close the polygon and fill with the current fill color |
|
dot() |
None |
Leave the dot at the current position |
|
stamp() |
None |
Leaves an impression of a Turtle shape at the current location |
|
shape() |
shapename |
Should be ‘arrow’, ‘classic’, ‘Turtle’ or ‘circle’ (veranderd de vorm) |
| circle() | radius,[ angle] | Draw a circle |
| write() | text | Write a text on screen (at turtles position) |
| hideturtle() | None | Hide Turtle |
rbg vulkleuren gebruiken turtle.colormode(255)
Math cheat cheat
Gebruiken van wiskunde
import math
| wortel | math.sqrt(...) |
| kwadraat | math.pow(...,2) |
| graden naar radialen | math.radians(...) |
| sinus | math.sin(...) Let op hoek in radialen |
| cosinus | math.cos(...) Let op hoek in radialen |
| tangens | math.tan(...) Let op hoek in radialen |