论程序员如何优雅的祝福老师教师节快乐


作为一个技术小白,在教师节之际,既想表明信息学人的身份,又要表达对于 老师的祝福,我感觉,以下技能应该是每个搞IT得人都应该具备得一项技能。

1.祝福新技能

新技能get1:使用turtle使用计算机绘画出字体“教师节快乐”,其效果图如下所示;
在这里插入图片描述
新技能get2:使用tkinter创建不同的弹窗,显示“教师节快乐“,其效果图如下:
在这里插入图片描述

2.新技能,请接住

第一式:神龙摆尾

# @Time : 2019/9/10 11:11 
# @Author : kingback
# @File : teachers_day_happy.py 
# @Software: PyCharm
import turtle as t
from time import sleep

x = -350
y = 50

t1 = (x, y)
t2 = (x + 12, y - 12)
penSize = 5

t.screensize(400, 400, "#fff")
t.pensize(penSize)
t.pencolor("#ff0000")
t.speed(8)
t.hideturtle()


# 教
def jiao():


    # 横 -
    x1 = x - 18
    y1 = y - 22
    t3 = (x1, y1)
    t4 = (x1 + 60, y1)
    t.up()
    t.goto(t3)
    t.down()
    t.goto(t4)

    # 竖 |
    x2 = x + 12
    y2 = y
    t5 = (x2, y2)
    t6 = (x2, y2 - 40)
    t.up()
    t.goto(t5)
    t.down()
    t.goto(t6)

    # 长横-
    x3 = x1 - 20
    y3 = y2 - 40
    t7 = (x3, y3)
    t8 = (x3 + 90, y3)
    t.up()
    t.goto(t7)
    t.down()
    t.goto(t8)

    # 撇
    x4 = x + 60
    y4 = y - 10
    t9 = (x4, y4)
    t10 = (x4 - 80, y4 - 70)
    t.up()
    t.goto(t9)
    t.down()
    t.goto(t10)

    # 横 -
    x5 = x4 - 55
    y5 = y4 - 50
    t11 = (x5, y5)
    t12 = (x5 + 30, y5)
    t.up()
    t.goto(t11)
    t.down()
    t.goto(t12)

    # 左拐
    x6 = x5+30
    y6 = y5
    t13 = (x6, y6)
    t14 = (x6-20, y6-20)
    t.up()
    t.goto(t13)
    t.down()
    t.goto(t14)

    # 右拐
    x7 = x6-20
    y7 = y6-20
    t15 = (x7, y7)
    t16 = (x7+10, y7 - 10)
    t.up()
    t.goto(t15)
    t.down()
    t.goto(t16)

    # 左拐
    x8 = x7+10
    y8 = y7-10
    t15 = (x8, y8)
    t16 = (x8 -20, y8 - 20)
    t.up()
    t.goto(t15)
    t.down()
    t.goto(t16)

    # 上钩
    x9 = x8 - 20
    y9 = y8 - 20
    t17 = (x9, y9)
    t18 = (x9-5,y9+5)
    t.up()
    t.goto(t17)
    t.down()
    t.goto(t18)

    # 横
    x10 = x6 - 35
    y10 = y6 - 20
    t19 = (x10, y10)
    t20 = (x10 +40, y10)
    t.up()
    t.goto(t19)
    t.down()
    t.goto(t20)

    #小恒
    x11 = x3 +110
    y11 = y3
    t21 = (x11, y11)
    t22 = (x11 + 50, y11)
    t.up()
    t.goto(t21)
    t.down()
    t.goto(t22)

    #上撇
    x12 = x11 + 20
    y12 = y3+20
    t23 = (x12, y12)
    t24 = (x12 -30, y12-30)
    t.up()
    t.goto(t23)
    t.down()
    t.goto(t24)

    # 下撇
    x13 = x11 + 40
    y13 = y3
    t25 = (x13, y13)
    t26 = (x13 - 60, y13 - 70)
    t.up()
    t.goto(t25)
    t.down()
    t.goto(t26)

    # 下纳
    x14 = x11-10
    y14 = y3-20
    t27 = (x14, y14)
    t28 = (x14+60, y14 - 50)
    t.up()
    t.goto(t27)
    t.down()
    t.goto(t28)


# 师
def shi():
    #竖
    x1 = x + 160
    y1 = y-30
    t1 = (x1, y1)
    t2 = (x1, y1 - 30)
    t.up()
    t.goto(t1)
    t.down()
    t.goto(t2)

    # 长竖
    x2 = x1 + 20
    y2 = y1 + 30
    t3 = (x2, y2)
    t4 = (x2, y2 - 100)
    t.up()
    t.goto(t3)
    t.down()
    t.goto(t4)

    # 左拐
    x3 = x2
    y3 = y2-100
    t5 = (x3, y3)
    t6 = (x3-6, y3 - 10)
    t.up()
    t.goto(t5)
    t.down()
    t.goto(t6)

    # 小恒
    x4 = x2+25
    y4 = y2 - 15
    t7 = (x4, y4)
    t8 = (x4+40, y4)
    t.up()
    t.goto(t7)
    t.down()
    t.goto(t8)

    # 小竖
    x5 = x4
    y5 = y4 - 25
    t9 = (x5, y5)
    t10 = (x5, y5-40)
    t.up()
    t.goto(t9)
    t.down()
    t.goto(t10)

    # 小横
    x6 = x5
    y6 = y5
    t11 = (x6, y6)
    t12 = (x6+50, y6)
    t.up()
    t.goto(t11)
    t.down()
    t.goto(t12)



    # 小竖
    x7 = x5+50
    y7 = y5
    t13 = (x7, y7)
    t14 = (x7, y7 - 40)
    t.up()
    t.goto(t13)
    t.down()
    t.goto(t14)

    # 竖钩
    x8 = x7
    y8 = y7 - 45
    t15 = (x8, y8)
    t16 = (x8-6, y8 +8)
    t.up()
    t.goto(t15)
    t.down()
    t.goto(t16)

    # 大竖
    x9 = x6+20
    y9 = y6+20
    t17 = (x9, y9)
    t18 = (x9, y9-100)
    t.up()
    t.goto(t17)
    t.down()
    t.goto(t18)


# 节
def jie():

    # 横
    x1 = x + 280
    y1 = y+20
    t1 = (x1, y1)
    t2 = (x1+70, y1)
    t.up()
    t.goto(t1)
    t.down()
    t.goto(t2)

    # 竖
    x2 = x1 + 25
    y2 = y1 + 20
    t3 = (x2, y2)
    t4 = (x2, y2-40)
    t.up()
    t.goto(t3)
    t.down()
    t.goto(t4)

    # →竖
    x3 = x2 + 25
    y3 = y2
    t5 = (x3, y3)
    t6 = (x3, y3- 40)
    t.up()
    t.goto(t5)
    t.down()
    t.goto(t6)

    # 横
    x4 = x2 -25
    y4 = y2-60
    t7 = (x4, y4)
    t8 = (x4+75, y4)
    t.up()
    t.goto(t7)
    t.down()
    t.goto(t8)

    # 竖
    x5 = x4 +75
    y5 = y4
    t9 = (x5, y5)
    t10 = (x5, y5-50)
    t.up()
    t.goto(t9)
    t.down()
    t.goto(t10)

    # 竖钩
    x6 = x5
    y6 = y5-50
    t11 = (x6, y6)
    t12 = (x6-9, y6+7)
    t.up()
    t.goto(t11)
    t.down()
    t.goto(t12)

    # 大竖
    x7 = x4 + 32
    y7 = y4
    t13 = (x7, y7)
    t14 = (x7, y7 - 80)
    t.up()
    t.goto(t13)
    t.down()
    t.goto(t14)


# 快
def kuai():
    # 点
    x1 =x+400
    y1 =y-65
    t1 = (x1, y1)
    t2 = (x1 - 6, y1 - 25)
    t.up()
    t.goto(t1)
    t.down()
    t.goto(t2)

    # 竖
    x2 = x1 + 10
    y2 = y - 15
    t3 = (x2, y2)
    t4 = (x2, y2 - 130)
    t.up()
    t.goto(t3)
    t.down()
    t.goto(t4)

    # 点
    x3 = x2 + 10
    y3 = y1 - 8
    t5 = (x3, y3)
    t6 = (x3 + 6, y3 - 10)
    t.up()
    t.goto(t5)
    t.down()
    t.goto(t6)

    # 横
    x4 = x3 + 25
    y4 = y - 60
    t7 = (x4, y4)
    t8 = (x4 + 60, y4)
    t9 = (x4 + 60, y4 - 28)
    t.up()
    t.goto(t7)
    t.down()
    t.goto(t8)
    t.goto(t9)

    # 长横
    x5 = x4 - 10
    y5 = y4 - 28
    t10 = (x5, y5)
    t11 = (x5 + 90, y5)
    t.up()
    t.goto(t10)
    t.down()
    t.goto(t11)

    # 撇
    x6 = x4 + 30
    y6 = y2 - 5
    t12 = (x6, y6)
    t13 = (x6 - 18, y6 - 125)
    t.up()
    t.goto(t12)
    t.down()
    t.goto(t13)

    # 捺
    x7 = x6 + 8
    y7 = y5 - 20
    t14 = (x7, y7)
    t15 = (x7 + 12, y7 - 38)
    t.up()
    t.goto(t14)
    t.down()
    t.goto(t15)


# 乐
def le():
    # 撇
    x1 = x + 600
    y1 = y - 20
    t1 = (x1, y1)
    t2 = (x1 - 65, y1 - 20)
    t3 = (x1 - 68, y1 - 60)
    t4 = (x1 + 10, y1 - 60)
    t.up()
    t.goto(t1)
    t.down()
    t.goto(t2)
    t.goto(t3)
    t.goto(t4)

    # 竖
    x2 = x1 - 30
    y2 = y1 - 35
    t5 = (x2, y2)
    t6 = (x2, y2 - 92)
    t7 = (x2 - 12, y2 - 85)
    t.up()
    t.goto(t5)
    t.down()
    t.goto(t6)
    t.goto(t7)

    # 点、、
    x3 = x2 - 20
    y3 = y2 - 50
    t8 = (x3, y3)
    t9 = (x3 - 8, y3 - 20)
    t.up()
    t.goto(t8)
    t.down()
    t.goto(t9)
    t10 = (x3 + 40, y3 - 5)
    t11 = (x3 + 46, y3 - 16)
    t.up()
    t.goto(t10)
    t.down()
    t.goto(t11)


# 开始调用函数进行绘画

jiao()
shi()
jie()
kuai()
le()

t.end_fill()  # 结束填充,显示填充效果

t.done()

第二式:乾坤大挪移

# @Time : 2019/9/10 22:10 
# @Author : kingback
# @File : teachers_day2.py 
# @Software: PyCharm
import tkinter as tk
import random
import threading
import time


def dow():
    window = tk.Tk()
    width = window.winfo_screenwidth()
    height = window.winfo_screenheight()
    a = random.randrange(0, width)
    b = random.randrange(0, height)
    window.title('教师节快乐')
    window.geometry("200x50" + "+" + str(a) + "+" + str(b))
    tk.Label(window,
             text='教师节快乐!',  # 标签的文字
             bg='Red',  # 背景颜色
             font=('楷体', 17),  # 字体和字体大小
             width=15, height=2  # 标签长宽
             ).pack()  # 固定窗口位置
    window.mainloop()


threads = []
for i in range(100):  # 需要的弹框数量
    t = threading.Thread(target=dow)
    threads.append(t)
    time.sleep(0.1)
    threads[i].start()

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

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
©️2022 CSDN 皮肤主题:大白 设计师:CSDN官方博客 返回首页
评论 12

打赏作者

王延凯的博客

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值