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
state= 0
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")
if state < 100:
pygame.draw.rect(screen,(255, 255, 255), ((WIDTH - size1)/2, (HEIGHT- size2)/2, size1,size2),2)
size1 += random.randint(25,50)
size2 += random.randint(25,50)
x = random.randint(0,500)
y = random.randint(0,500)
pygame.draw.circle(screen,(255,0,0), (x, y), 25)
pygame.display.flip()
state += 1
pygame.quit()
|