国庆中秋双重喜庆

国庆中秋双重喜庆

"""
   国庆中秋双重喜庆.py
"""
import time
import random
import turtle
from bitmapfont import *
from winsound import *

__author__ = '李兴球'
__date__ = '2020/9/28'

PlaySound('华语群星 - 浏阳河+回娘家+红彩妹妹 (平四版).wav',SND_LOOP|SND_ASYNC)

def steped_write(s):
    """逐字写"""
    for char in s:
        turtle.write(char,move=True,align='center',font=ft)
        turtle.fd(10)
        time.sleep(0.3)
   
alldots = []
def show_charactar(char,scale):
    fontSet = open("./HZK16", "rb")
    for i in getCharacterMatrixMode(fontSet, char):
        for k in i:
            if(int(k)):
                turtle.dot(5*scale)
                alldots.append(turtle.getturtle().items[-1])
                turtle.fd(5*scale)
            else:
                turtle.fd(5*scale)
        turtle.bk(16*5*scale)
        turtle.right(90)
        turtle.fd(5*scale)
        turtle.left(90)
        time.sleep(0.1)

turtle.delay(0)
turtle.speed(0)
turtle.penup()
turtle.setup(480,800)
turtle.bgcolor('black')
turtle.hideturtle()

turtle.color('white')
turtle.goto(-140,330)
show_charactar('祝',1)

turtle.goto(50,330)
show_charactar('您',1)

turtle.color('red')
turtle.goto(-170,190)
show_charactar('国',1.5)

turtle.color('orange')
turtle.goto(30,190)
show_charactar('庆',1.5)

turtle.color('yellow')
turtle.goto(-170,20)
show_charactar('中',1.5)

turtle.color('green')
turtle.goto(30,20)
show_charactar('秋',1.5)

turtle.color('cyan')
turtle.goto(-170,-180)
show_charactar('快',2)

turtle.color('blue')
turtle.goto(30,-180)
show_charactar('乐',2)

turtle.goto(-170,-140)
turtle.color('white')
ft = ('楷体',18,'underline')
steped_write('本程序由Python海龟画图模块制作')
#turtle.write('本程序由Python海龟画图模块制作',align='center',font=ft)

turtle.goto(0,-170)
turtle.color('white')
turtle.write('源码免费下载网址 www.lixingqiu.com',align='center',font=ft)
witem = turtle.getturtle().items[-1]

cs = ['red','orange','yellow','green',
      'cyan','blue','pink','white']

canvas = turtle.getcanvas()

c = 0
index = 0
j = 0
while True:
    dot = alldots[index]    
    canvas.itemconfig(dot,fill=cs[c%len(cs)])
    canvas.update()
    time.sleep(0.01)
    index = index + 1
    index = index % len(alldots)
    if index == 0 : c = c + 1        
    c = c + 1    
    time.sleep(0.1)
    j = j + 1
    if j % 8 == 0 : canvas.itemconfig(witem,fill=random.choice(cs))

本资源于2020年国庆期间是免费下载,现在国庆已过,需要下载请扫码付费:

[hide]

国庆中秋双重喜庆下载:
链接:https://pan.baidu.com/s/1U3Jh2J2H4Ax7w1_smjCNZQ

提取码:kx4a

[/hide]

李兴球

李兴球的博客是Python创意编程原创博客