Py学习Day1:turtle函数

turtle函数常用汇总:

>>> import turtle #导入 turtle 模块

>>> turtle.showturtle() #显示箭头

>>> turtle.write("XX") #写字符串

>>> turtle.forward(300) #前进 

>>> turtle.color("red") #画笔颜色

>>> turtle.left(90) #箭头左转 

>>> turtle.goto(X,Y) #去坐标(X,Y)

>>> turtle.penup() #抬笔

>>> turtle.pendown() #下笔

#画五环
import turtle 
turtle.width(10)
turtle.color("black")
turtle.circle(50)
turtle.penup()
turtle.color("blue")
turtle.goto(-120,0)
turtle.pendown()
turtle.circle(50)
turtle.penup()
turtle.color("red")
turtle.goto(120,0)
turtle.pendown()
turtle.circle(50)
turtle.penup()
turtle.color("yellow")
turtle.goto(-60,-35)
turtle.pendown()
turtle.circle(50)
turtle.penup()
turtle.color("green")
turtle.goto(60,-35)
turtle.pendown()
turtle.circle(50)

结果:

Py学习Day1:turtle函数_第1张图片

你可能感兴趣的:(学习)