import pygame from pygame.locals import * import sys pygame.init() display = pygame.display.set_mode((300,300)) FPS_CLOCK = pygame.time.Clock() while 1: for event in pygame.event.get(): print(pygame.mouse.get_pos()) print(pygame.mouse.get_rel()) if event.type == QUIT: pygame.quit() sys.exit() pygame.display.update() FPS_CLOCK.TICK(30)