绘制六边形

image

import turtle as t
def draw():

    t.forward(150)


def draw_circle():
    t.right(120)
    t.forward(150)
    t.right(120)
    t.forward(150)
    t.right(120)
    t.forward(150)
    t.left(60)
def draw_fal():

    t.forward(150)
    t.left(60)




t.hideturtle()
t.pensize(4)
t.color("#f1ac7a")
t.goto(150,0)
t.seth(120)


for i in range(6):
    t.begin_fill()
    t.speed(0)
    t.fillcolor("green")
    draw()
    draw_circle()
    t.end_fill()
t.seth(120)
t.begin_fill()
for j in range(6):
    draw_fal()
t.fillcolor("red")
t.end_fill()
t.exitonclick() #turtle执行完后保留那个页面




image

posted @ 2022-10-15 16:43  Selina风乎舞雩  阅读(130)  评论(0)    收藏  举报