#!/bin/python
import pygame, sys
import random
green = (0, 255, 0)
blue = (0, 0, 128)
red = (255, 0, 0)
pygame.init()
sc = pygame.display.set_mode((640, 500))
pygame.display.set_caption("Кружочки на pygame")
clock = pygame.time.Clock()
color_1 = (random.randint(0,255),random.randint(0,255),random.randint(0,255))
color_2 = (random.randint(0,255),random.randint(0,255),random.randint(0,255))
color_3 = (random.randint(0,255),random.randint(0,255),random.randint(0,255))
while True:
sc.fill((125,125,125))
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.draw.line(sc, (0,0,0), [10, 50], [490, 50], 3)
pygame.draw.line(sc, (0,0,0), [10, 300], [490, 300], 3)
pygame.draw.line(sc, (0,0,0), [10, 50], [10, 300], 3)
pygame.draw.line(sc, (0,0,0), [490, 50], [490, 300], 3)
pygame.draw.circle(sc,color_1 , (100, 150), 70)
pygame.draw.circle(sc,color_2 , (200, 150), 70)
pygame.draw.circle(sc,color_3 , (300, 150), 70)
pygame.display.flip()
pygame.image.save(sc, "image.png")
|