A brief introduction to a little sea turtle, understanding the basic structure of the little sea turtle, and then drawing a five-pointed star.
import turtle #调用turtle值,即海龟值
turtle.setup(800,400,300,300) #窗口左侧与屏幕左侧距离x为300,窗口顶侧与屏幕顶侧距离y为300,长为800,宽为400
turtle.penup() #抬起画笔,之后移动画笔不绘制形状
turtle.fd(-200) #后退200
turtle.pendown() #落下画笔,之后移动画笔将绘制形状
turtle.pensize(8) #设置画笔宽度
turtle.pencolor(1,0,0) #设置画笔颜色,(r,g,b)对应RGB数值
for i in range(5): #小海龟遍历循环5次
turtle.fd(200) #向小海龟当前行进方向前进200
turtle.right(144) #向右边旋转144°
turtle.done() #结束
Original link: https://blog.csdn.net/A6_107, if you need to reprint this article, you need to get the consent of the author of this article before reprinting.