import pygame
import sys
import random
pygame.init()
sc = pygame.display.set_mode((700, 700))
sc.fill((0, 0, 0))
color1 =(random.randint(0,255),random.randint(0,255),random.randint(0,255))
color2 =(random.randint(0,255),random.randint(0,255),random.randint(0,255))
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_RETURN:
pygame.image.save(sc, "image.jpg")
for x in range(-500,500,1):
y=-20 + (x*x)/20
pygame.draw.rect(sc,color1,(x+325,y+200,5,5))
y=(-200 + (x*x)/20)*-1
pygame.draw.rect(sc,color2,(x+325,y-20,5,5))
pygame.display.update()
|