import pygame
import random
import math
WIDTH = 500
HEIGHT = 500
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
running = True
clock = pygame.time.Clock()
sz=10
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
pygame.image.save(screen, "image.jpg")
screen.fill((255,255,255))
f1 = pygame.font.Font(None, sz)
r = random.randint(0,255)
g = random.randint(0,255)
b = random.randint(0,255)
text1 = f1.render('Привет', True,(r, g, b))
screen.blit(text1, (100,250))
pygame.display.flip()
sz = sz + 1
clock.tick(60)
pygame.quit()
|