(1)由键盘输入等边三角形的边长值,根据边长值绘制六角星
(2)给六角星进行颜色填充
import turtle as t
length=int(input("请输入一个整数"))
t.setup(1000,1000,100,100)
t.speed(10)
for hhhh in range(6):
t.fillcolor("yellow")
t.begin_fill()
for x in range(3):
t.fd(length)
t.left(120)
t.end_fill()
t.fd(length)
t.right(60)
t.goto(0,0)
t.fillcolor("red")
t.begin_fill()
for hhhh in range(6):
t.fd(length)
t.right(60)
t.end_fill()
t.done()
#speed()绘制速度
效果: