import pygame import sys import random pygame.init() pygame.display.set_caption("Task2") displaysurface = pygame.display.set_mode((300, 300)) mySurface = pygame.Surface((50, 50)) mySurface.fill( (255,0,0))#Red mySurface2 = pygame.Surface((100, 50)) mySurface2.fill( (0,0, 255)) #Blue rand1 = random.randint(1,255) rand2 = random.randint(1,255) rand3 = random.randint(1,255) #mySurface.fill( (0,255, 0)) #Green #mySurface.fill( (0,0, 255)) #Blue #mySurface.fill( (255,0, 0)) #Red while True: events = pygame.event.get() for event in events: if event.type == pygame.QUIT: pygame.quit() sys.exit() displaysurface.blit(mySurface, (50,50)) displaysurface.blit(mySurface2, (50,150)) pygame.display.update()