import random
import pygame
from pygame.locals import *
from sys import exit
PANEL_width = 1024
PANEL_highly = 768
FONT_PX = 20
pygame.init()
winSur = pygame.display.set_mode((PANEL_width, PANEL_highly), FULLSCREEN, 32)
font = pygame.font.SysFont("123.ttf", 25)
bg_suface = pygame.Surface((PANEL_width, PANEL_highly), flags=pygame.SRCALPHA)
pygame.Surface.convert(bg_suface)
bg_suface.fill(pygame.Color(0, 0, 0, 16))
winSur.fill((0, 0, 0))
letter = ['1', '0', '1', '1', '1', '0', '0', '0', '1', '0', '1', '0', '1', '0', '0', '1', '1', '0', '0', '0', '1', '1'
,'1', '0', '1', '0', '0', '1', '0', '1']
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(30)
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()
|