用户:
尴尬哲查看:0 回复:0 评论:0 创建时间:2023-04-29T18:11:59
【作品展示】

【作品介绍】
空格键关闭
【作品源代码】
import random
import pygame
from pygame.locals import*
from sys import exit
PANEL_width = 1920
PANEL_highly = 1080
FONT_PX = 40
pygame.init()
winSur = pygame.display.set_mode((PANEL_width, PANEL_highly), FULLSCREEN, 32)
font = pygame.font.SysFont("黑客帝国代码雨", 35)
bg_suface = pygame.Surface((PANEL_width, PANEL_highly), flags=pygame.SRCALPHA)
pygame.Surface.convert(bg_suface)
bg_suface.fill(pygame.Color(0, 0, 0, 20))
winSur.fill((0, 0, 0))
letter = ['a','b','c','d','e','f','g','h','I','j','k','I','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
texts = [
font.render(str(letter[i]), True, (0, 255, 0)) for i in range(20)
]
column = int(PANEL_width / FONT_PX)
drops = [0 for i in range(column)]
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
elif event.type == pygame.KEYDOWN:
chang = pygame.key.get_pressed()
if (chang[32]):
exit()
pygame.time.delay(40)
winSur.blit(bg_suface, (0, 0))
for i in range(len(drops)):
text = random.choice(texts)
winSur.blit(text, (i*FONT_PX, drops[i]*FONT_PX))
drops[i] += 1
if drops[i]*10 > PANEL_highly or random.random() > 0.95:
drops[i] = 0
pygame.display.flip()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn