import pygame
import random
pygame.init()
win = pygame.display.set_mode((500,500))
pygame.display.set_caption("")
x = 250
y = 100
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
pygame.image.save(win, "image.jpg")
win.fill((0,0,0))
pygame.draw.rect(win, (255, 255, 255), (x, y+10, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x-50, y+60, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x+50, y+60, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x-100, y+110, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x+100, y+110, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x-50, y+160, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x+50, y+160, 50,50))
pygame.draw.rect(win, (255, 255, 255), (x, y+210, 50,50))
pygame.display.update()
pygame.quit()
|