2020 03 11
简单图形制作
1 #叠边形 2 import turtle 3 turtle.setup(650,500,200,200) 4 turtle.pensize(2) 5 turtle.right(120) 6 for i in range(3): 7 turtle.fd(90) 8 turtle.left(120) 9 turtle.seth(-120) 10 turtle.fd(45) 11 turtle.seth(0) 12 for i in range(3): 13 turtle.fd(45) 14 turtle.right(120)
1 #六角形 2 import turtle 3 turtle.setup(650,500,200,200) 4 turtle.pensize(5) 5 turtle.seth(-90) 6 for i in range(3): 7 turtle.fd(90) 8 turtle.left(120) 9 turtle.fd(30) 10 turtle.right(60) 11 turtle.fd(30) 12 turtle.seth(-30) 13 for i in range(3): 14 turtle.fd(90) 15 turtle.left(120)
1 #五角星 2 import turtle 3 turtle.setup(650,500,200,200) 4 turtle.pensize(1) 5 turtle.fillcolor("red") 6 turtle.begin_fill() 7 for i in range(5): 8 turtle.fd(200) 9 turtle.left(216) 10 turtle.end_fill()