huahua~

import turtle

t = turtle.Pen()  # 画笔一 用于画图
t.speed(0)


# 花纹颜色 #F29407
# 饼身颜色 #F8B41A

# 画 饼身部分
def outfill_flower(flower_num: "花瓣数量", flower_color: "花瓣颜色"):
    for i in range(flower_num):
        t.left(i * (360 // flower_num))
        t.color(flower_color)
        t.penup()
        t.forward(200)
        t.pendown()
        t.fillcolor(flower_color)
        t.begin_fill()
        t.circle(60)
        t.end_fill()
        t.penup()
        t.home()


# 画 饼身外围 花纹部分
def out_line_flower(flower_num: "花纹数量", flower_color: "花纹颜色"):
    for i in range(flower_num):
        t.pensize(5)
        t.left(i * (360 // 18))
        t.color(flower_color)
        t.penup()
        t.forward(192)
        t.pendown()
        t.circle(60)
        t.penup()
        t.home()


# 画内测的大圆 大圆的填充色比饼身略亮
def big_circle(circle_color: "大圆颜色", circle_fill_color: "大圆填充颜色", circle_size: "大圆半径"):
    t.goto(circle_size, 0)
    t.left(90)
    t.pendown()
    t.pensize(8)
    t.color(circle_color)
    t.fillcolor(circle_fill_color)
    t.begin_fill()
    t.circle(circle_size)
    t.end_fill()
    t.penup()
    t.home()


# 饼上印花文字 文字内容和坐标用字典存储
def write_font(text_content: "文本内容", text_color: "文本颜色", size: "文字大小"):
    t.color(text_color)
    for x in text_content:
        t.penup()
        t.goto(text_content[x])
        t.write(x, align='center', font=('simhei', size, 'bold'))
    t.penup()
    t.home()
    t.color('#F29407')


# 饼身中间矩形条纹部分
def body_center_line(width: "矩形宽度", height: "矩形高度"):
    t.penup()
    t.home()
    t.pensize(4)
    t.pendown()
    t.backward(width / 2)
    t.forward(width)
    t.left(90)
    t.forward(height)
    t.left(90)
    t.forward(width)
    t.left(90)
    t.forward(height * 2)
    t.left(90)
    t.forward(width)
    t.left(90)
    t.forward(height)
    t.penup()
    t.home()

if __name__ == "__main__":
   # 设置画布名称
    t.screen.title('中秋快乐')
    # 画 饼身部分
    outfill_flower(18, '#F8B41A')
    # 画 饼身外围 花纹部分
    out_line_flower(18, '#F29407')
    # 画内测的大圆 大圆的填充色比饼身略亮
    # big_circle('#F29407','#F8B41A',200)
    big_circle('#F29407', '#F8B51D', 200)


    # 隐藏画笔
    t.hideturtle()
    # 保持画布显示
    turtle.done()

 这是个大向日葵,自己可以改改大小,多来几个就可以有一片花海

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值