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