绘制五角星
import turtle turtle.setup(600,350,200,200)#起始位置 turtle.pensize(2)#画笔大小 turtle.pencolor("black")#画笔颜色 turtle.fillcolor("red")#填充颜色 turtle.begin_fill() for i in range(5): turtle.forward(200)#前进距离 turtle.right(144)#右转角度 turtle.end_fill()
绘制六角星import turtle turtle.left(30)#左转角度 turtle.forward(144)#前进距离 turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.right(60) turtle.forward(144) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.left(60) turtle.forward(144) turtle.right(120) turtle.forward(144) turtle.exitonclick()
绘制叠边三角形
import turtle turtle.pensize(5) turtle.pencolor("black") turtle.seth(0)#改变角度 turtle.fd(200) turtle.seth(120) turtle.fd(200) turtle.seth(240) turtle.fd(200) turtle.seth(0) turtle.fd(100) turtle.seth(60) turtle.fd(100) turtle.seth(180) turtle.fd(100) turtle.seth(300) turtle.fd(100) turtle.d