import pygame from pygame.locals import * import sys pygame.init() sc = pygame.display.set_mode((500, 500)) pygame.display.set_caption("ABC") clock = pygame.time.Clock() x=0 dx=10 while (True): clock.tick(10) x=x+dx if x>200: dx=-10 if x<30: dx=10 sc.fill((x,0,0)) pygame.display.update() for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() if event.type==MOUSEBUTTONDOWN: (x,y)=event.pos print(x) print(y)