import pygame
import random
def generate_alf():
alf = 'абвгдеёжзийклмнопрстуфхцчшщъыьэюя'
new_text = ""
nindex = []
for i in range(0,len(alf)):
nindex.append(i)
for i in range(0,(len(alf))):
ind = random.randint(0,len(alf)-1)
n = nindex[ind]
nindex[ind] = nindex[i]
nindex[i] = n
for i in range(0,len(alf)):
sym = alf[nindex[i]]
new_text = new_text[:i] + sym + new_text[i:]
return new_text
WIDTH = 825
HEIGHT = 700
FPS = 60
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
f1 = pygame.font.Font(None, 36)
running = True
obj_y = 0
alf = generate_alf()
for it_1 in range(0,825,25):
for it_2 in range(0,825,25):
pygame.draw.rect(screen,WHITE, (it_1,it_2,24,24))
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if ( obj_y < 500):
alf = generate_alf()
for i in range(0,len(alf)):
text1 = f1.render(alf[i], False,(0, 180, 0))
screen.blit(text1, (i*25,obj_y))
obj_y += 25
pygame.display.flip()
pygame.time.delay(250)
pygame.quit()
|