import pygame
import random

pygame.init()
ekran = pygame.display.set_mode((800, 650))
zegar = pygame.time.Clock()
tlo = [0,0,0]

run = True
frames = 0
rgb1 = 0
rgb2 = 0
rgb3 =0
while run:
    for e in pygame.event.get():
        if e.type == pygame.QUIT: run = False
    frames += 1
    if frames == 180:
        rgb1 = random.randint(1,255)
        rgb2 = random.randint(1,255)
        rgb3 = random.randint(1,255)
        frames = 0
    ekran.fill((rgb1,rgb2,rgb3))
    pygame.display.flip()
    zegar.tick(60)
pygame.quit()