import pygame
import random
import math
WIDTH = 700
HEIGHT = 700
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
clock = pygame.time.Clock()
surf = pygame.Surface((50,50))
surf.fill(BLACK)
rotate_surf = pygame.Surface((500,500))
rotate_surf.fill(BLACK)
running = True
while running:
clock.tick(50)
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(WHITE)
for q in range(0,500,50):
for w in range(0,500,50):
pygame.draw.rect(surf, (255,255,0), (q,w, 25,25))
screen.blit(surf, (q,w))
rotate_surf = pygame.transform.rotate(surf,random.randint(0,360))
screen.blit(rotate_surf, (q,w))
pygame.display.flip()
pygame.quit()
|