• 【主题课】9.10教师节电子贺卡制作


    9.10是教师节,提到老师,大家首先想到的可能就是在学校中教我们文化课的人,
    除此之外,在生活或工作中给予我们指导及帮助的人也可称之为老师
    本次课我们就使用 Python 来为所有的老师送上节日的祝福。

    课程目标

    1. 通过电子贺卡制作,让学生学会阅读源码、巩固课堂知识,如海龟绘图、循环结构、列表使用。
    2. 通过完成任务,训练学生数学计算能力和创意创造能力。

    课堂任务

    • 任务1、运用精确的数学计算,修改绘制花的参数:旋转角度、旋转次数,使得能够闭合。【2积分】
    • 任务2、加上自己的名字和祝福语,使用 turtle.write 。【3积分】
    • 任务3、美化贺卡,如加花边、绘制七彩向日葵等,可自己创意【5积分】
      c_li = [‘yellow’, ‘magenta’, ‘cyan’, ‘blue’, ‘gold’, ‘pink’]

    源码及效果

    baseline 源码

    import turtle
    turtle.setup(800, 800, 200, 200) #setup设置窗体大小,四个参数中后两个参数非必选参数;
    turtle.pencolor("yellow") 
    turtle.pensize(4)
    turtle.penup()
    # turtle库准备
    
    turtle.fd(-150)
    turtle.pendown()
    
    '''
    花的绘制, (旋转角度)100*18(旋转次数),
    刚好为360度的5倍,因而能够闭合。
    '''
    for i in range(18): # 旋转次数
         turtle.fd(300) # 步长
         turtle.left(100) # 旋转角度
    
    
    # 茎秆部分,移动画笔到合适位置
    turtle.fd(150)
    turtle.right(90)
    turtle.pensize(8)
    turtle.pencolor("green")
    turtle.fd(400)
    turtle.penup()
    turtle.pensize(6)
    turtle.pendown()
    
    # 叶子的绘制
    turtle.fd(-250)
    turtle.seth(45) # seth()改变海龟行进方向;angle为据对度数;seth()只改变方向但是不行进;
    turtle.circle(-130,60) # turtle.circle(r,extent=NONE):根据半径r绘制extent角度的弧形,r默认在圆心左侧R距离的位置;extent:绘制角度默认360度是整圆;
    turtle.seth(-135)
    turtle.circle(-130,60)
    turtle.seth(135)
    turtle.circle(130,60)
    turtle.seth(-45)
    turtle.circle(130,60)
    turtle.done()
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41

    baseline 效果:

    初始效果图

    任务一源码

    import turtle
    turtle.setup(800, 800, 200, 200) #setup设置窗体大小,四个参数中后两个参数非必选参数;
    turtle.pencolor("yellow")
    turtle.pensize(4)
    turtle.penup()
    # turtle库准备
    
    turtle.fd(-150)
    turtle.pendown()
    
    '''
    花的绘制, (旋转角度)100*18(旋转次数),
    刚好为360度的5倍,因而能够闭合。
    '''
    for i in range(36): # 旋转次数
         turtle.fd(300) # 步长
         # turtle.circle(10)
         turtle.left(110) # 旋转角度
    
    
    # 茎秆部分,移动画笔到合适位置
    turtle.fd(150)
    turtle.right(90)
    turtle.pensize(8)
    turtle.pencolor("green")
    turtle.fd(400)
    turtle.penup()
    turtle.pensize(6)
    turtle.pendown()
    
    # 叶子的绘制
    turtle.fd(-250)
    turtle.seth(45) # seth()改变海龟行进方向;angle为据对度数;seth()只改变方向但是不行进;
    turtle.circle(-130,60) # turtle.circle(r,extent=NONE):根据半径r绘制extent角度的弧形,r默认在圆心左侧R距离的位置;extent:绘制角度默认360度是整圆;
    turtle.seth(-135)
    turtle.circle(-130,60)
    turtle.seth(135)
    turtle.circle(130,60)
    turtle.seth(-45)
    turtle.circle(130,60)
    turtle.done()
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41

    任务一效果

    在这里插入图片描述

    任务二源码

    import turtle
    turtle.setup(800, 800, 200, 200) #setup设置窗体大小,四个参数中后两个参数非必选参数;
    turtle.pencolor("yellow")
    turtle.pensize(4)
    turtle.penup()
    # turtle库准备
    
    turtle.fd(-150)
    turtle.pendown()
    
    '''
    花的绘制, (旋转角度)100*18(旋转次数),
    刚好为360度的5倍,因而能够闭合。
    '''
    for i in range(36): # 旋转次数
         turtle.fd(300) # 步长
         # turtle.circle(10)
         turtle.left(110) # 旋转角度
    
    
    # 茎秆部分,移动画笔到合适位置
    turtle.fd(150)
    turtle.right(90)
    turtle.pensize(8)
    turtle.pencolor("green")
    turtle.fd(400)
    turtle.penup()
    turtle.pensize(6)
    turtle.pendown()
    
    # 叶子的绘制
    turtle.fd(-250)
    turtle.seth(45) # seth()改变海龟行进方向;angle为据对度数;seth()只改变方向但是不行进;
    turtle.circle(-130,60) # turtle.circle(r,extent=NONE):根据半径r绘制extent角度的弧形,r默认在圆心左侧R距离的位置;extent:绘制角度默认360度是整圆;
    turtle.seth(-135)
    turtle.circle(-130,60)
    turtle.seth(135)
    turtle.circle(130,60)
    turtle.seth(-45)
    turtle.circle(130,60)
    
    # 新增名字和祝福语
    turtle.penup()
    turtle.seth(90)
    turtle.fd(220)
    turtle.write("老师,您辛苦了!\n              --Logi", align="center",font=("宋体",24,"normal"))
    turtle.done()
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48

    任务二效果

    在这里插入图片描述

    任务三源码

    import turtle
    turtle.setup(800, 800, 200, 200) #setup设置窗体大小,四个参数中后两个参数非必选参数;
    turtle.pencolor("yellow")
    turtle.pensize(4)
    turtle.screensize(bg='black')
    turtle.penup()
    # turtle库准备
    
    turtle.fd(-150)
    turtle.pendown()
    
    '''
    花的绘制, (旋转角度)100*18(旋转次数),
    刚好为360度的5倍,因而能够闭合。
    '''
    c_li = ['yellow', 'magenta', 'cyan', 'blue', 'gold', 'pink']
    
    for i in range(36): # 旋转次数
        turtle.pencolor(c_li[i%len(c_li)])
        turtle.fd(300) # 步长
        turtle.left(110) # 旋转角度
        turtle.circle(3)
    
    # 茎秆部分,移动画笔到合适位置
    turtle.fd(150)
    turtle.right(90)
    turtle.pensize(8)
    turtle.pencolor("green")
    turtle.fd(400)
    turtle.penup()
    turtle.pensize(6)
    turtle.pendown()
    
    # 叶子的绘制
    turtle.fd(-250)
    turtle.seth(45) # seth()改变海龟行进方向;angle为据对度数;seth()只改变方向但是不行进;
    turtle.circle(-130,60) # turtle.circle(r,extent=NONE):根据半径r绘制extent角度的弧形,r默认在圆心左侧R距离的位置;extent:绘制角度默认360度是整圆;
    turtle.seth(-135)
    turtle.circle(-130,60)
    turtle.seth(135)
    turtle.circle(130,60)
    turtle.seth(-45)
    turtle.circle(130,60)
    
    # 新增名字和祝福语
    turtle.penup()
    turtle.seth(90)
    turtle.fd(220)
    turtle.write("老师,您辛苦了!\n              --Logi", align="center",font=("宋体",24,"normal"))
    turtle.done()
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50

    任务三效果

    在这里插入图片描述

    学生作品展

    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述
    在这里插入图片描述

    在这里插入图片描述

  • 相关阅读:
    K8s 暴露服务的新方法 Gateway API 详解,它有什么好处?
    Linux 5种网络模型
    FPGA对EEPROM驱动控制(I2C协议)
    流媒体直播播放协议:HLS、RTMP、HTTP-FLV
    CPU缓存一致性协议剖析
    经典面试题-Python装饰器
    基于Delft3D模型水体流动、污染物对流扩散、质点运移、溢油漂移及地表水环境报告编制教程
    第三节:在WORD为应用主窗口下关闭EXCEL的操作(2)
    分库分表
    Windows网络管理及诊断命令整理
  • 原文地址:https://blog.csdn.net/Sinsa110/article/details/132754233