python画六边形
图片

python代码
import turtle
import time
turtle.penup()
turtle.goto(-90,90)
turtle.pendown()
turtle.pensize(5)
turtle.pencolor("red")
for i in range(3):
turtle.fd(180)
turtle.right(120)
turtle.right(60)
turtle.fd(60)
turtle.right(60)
turtle.fd(60)
turtle.seth(60)
for i in range(3):
turtle.fd(180)
turtle.right((120))
turtle.done()
import turtle
turtle.penup()
turtle.goto(-90,90)
turtle.pendown()
turtle.pensize(5)
turtle.pencolor("red")
turtle.begin_fill()
turtle.fillcolor("yellow")
for i in range(3):
turtle.fd(180)
turtle.right(120)
turtle.right(60)
turtle.fd(60)
turtle.right(60)
turtle.fd(60)
turtle.seth(60)
for i in range(3):
turtle.fd(180)
turtle.right((120))
turtle.fd(60)
turtle.end_fill()
time.sleep(2)
turtle.penup()
turtle.goto(-150,-120)
turtle.color("violet")
turtle.write("peak", font=('Arial', 40, 'normal'))
turtle.done()