import pygame
import random
import math
WIDTH = 500
HEIGHT = 500
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
running = True
size1 = 50
size2 = 50
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")
pygame.draw.rect(screen,(255, 255, 255), ((WIDTH - size1)/2, (HEIGHT- size1)/2, size1,size2),2)
size1 += random.randint(25,50)
size2 += random.randint(25,50)
pygame.display.flip()
pygame.quit()
|