import pygame from pygame.locals import * import sys pygame.init() display = pygame.display.set_mode((300,300)) FPS_CLOCK = pygame.time.Clock() while 1: left, middle, right = pygame.mouse.get_pressed() if left: print("Left mouse key has been pressed") for event in pygame.event.get(): if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update() FPS_CLOCK.tick(30)