Здравствуй小王- 2022-05-30 07:02 采纳率: 66.7%
浏览 106
已结题

Python中turtle库的运用

turtle库绘图程序运行正常,代码行数超过30
行,有分支结构和循环结构,代码书写规范整洁,有注释。做出下图效果,90填充红色。

img

  • 写回答

2条回答 默认 最新

  • 溪风沐雪 2022-05-30 12:02
    关注

    画了半天,看看是否可以

    import math
    import turtle as t
    t.color('red')
    #t.tracer(10,1)
    t.begin_fill()
    t.right(130)
    for i in range(184):
        if i<175:
            t.fd(3)
        else:
            t.fd(30)
        t.right(2)
    t.left(138)
    t.fd(30)
    t.left(42)
    for i in range(185):
        if i<9:
            t.fd(30)
            t.left(2.5)
        else:
            t.fd(3.5)
            t.left(1.8)
    t.end_fill()
    t.penup()
    t.goto(280,-30)
    t.pendown()
    t.begin_fill()
    for i in range(500):
        radian = 2 * math.pi / 500 
        theta = (i+1)*radian
        next_point = (100*math.cos(theta)+180, 180*math.sin(theta)-20)
        t.setpos(next_point)
    t.goto(255,-30)
    t.end_fill()
    t.color('white')
    t.begin_fill()
    for i in range(500):
        radian = 2 * math.pi / 500 
        theta = (i+1)*radian
        next_point = (75*math.cos(theta)+180, 155*math.sin(theta)-20)
        t.setpos(next_point)
    t.end_fill()
    t.color('red')
    t.penup()
    t.goto(-120,60)
    t.pendown()
    t.write('北国',font=("宋体",35,"bold"))
    t.penup()
    t.goto(-120,10)
    t.pendown()
    t.write('药苑',font=("宋体",35,"bold"))
    t.penup()
    t.goto(160,60)
    t.pendown()
    t.write('红',font=("宋体",35,"bold"))
    t.penup()
    t.goto(160,0)
    t.pendown()
    t.write('色',font=("宋体",35,"bold"))
    t.penup()
    t.goto(160,-60)
    t.pendown()
    t.write('传',font=("宋体",35,"bold"))
    t.penup()
    t.goto(160,-120)
    t.pendown()
    t.write('承',font=("宋体",35,"bold"))
    #t.update()
    t.done()
    
    

    img

    展开全部

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
    2401_85209061 2024-05-22 05:18

    你好,这可以私信吗?

    回复
查看更多回答(1条)
编辑
预览

报告相同问题?

问题事件

  • 系统已结题 6月6日
  • 已采纳回答 5月30日
  • 修改了问题 5月30日
  • 创建了问题 5月30日
手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部