import pygame
import sys
FPS = 60
W = 300
H = 500
WHITE = (255, 255, 255)
GREEN = (0,100, 0)
RED = (100, 0, 0)
YELLOW = (200,200,0)
sc = pygame.display.set_mode((W, H))
clock = pygame.time.Clock()
pygame.time.set_timer(pygame.USEREVENT, 1000)
x = W // 2
y = H // 2
r = 50
counter = 0
while 1:
for i in pygame.event.get():
if i.type == pygame.QUIT:
sys.exit()
if i.type == pygame.USEREVENT:
counter = counter + 1
if counter == 4: counter = 1
sc.fill(WHITE)
if counter == 1:
GREEN =(0,100,0)
RED = (255, 0,0)
if counter == 2:
RED = (100, 0,0)
YELLOW = (255,255,0)
if counter == 3:
YELLOW = (200,200,0)
GREEN = (0,255, 0)
pygame.draw.circle(sc, RED, (150, 50), r)
pygame.draw.circle(sc, YELLOW, (150, 150), r)
pygame.draw.circle(sc,GREEN, (150, 250), r)
pygame.display.update()
clock.tick(FPS)
|