关键的几个代码:
forward() | fd()
backward() | bk() | back()
right() | rt()
left() | lt()
goto() | setpos() | setposition()
setx()
sety()
setheading() | seth()
home()
circle()
dot()
stamp()
clearstamp()
clearstamps()
undo()
speed()
position() | pos()
towards()
xcor()
ycor()
heading()
distance()
Setting and measurement
degrees()
radians()
pendown() | pd() | down()
penup() | pu() | up()
pensize() | width()
pen()
isdown()
color()
pencolor()
fillcolor()
Filling
fill()
begin_fill()
end_fill()
example:画个苹果
import turtle
turtle.pendown()
turtle.fillcolor("red")
turtle.begin_fill()
turtle.circle(60, 360)
turtle.end_fill()
turtle.circle(60,180)
turtle.left(90)
turtle.forward(20)
turtle.left(90)
turtle.forward(10)
turtle.back(20)
turtle.forward(10)
turtle.left(90)
turtle.forward(50)
turtle.back(20)
turtle.left(180)
turtle.penup()
turtle.circle(60, 270)
turtle.pendown()
turtle.fillcolor("green")
turtle.begin_fill()
turtle.circle(60, 90)
turtle.left(90)
turtle.circle(60, 90)
turtle.left(135)
turtle.fd(90)
turtle.end_fill()
turtle.done()