import pygame

# Run this program, then move your mouse, press keys, and click.
# Watch the terminal to see what events pygame reports.

pygame.init()

screen = pygame.display.set_mode((640, 480))
pygame.display.set_caption("Print Events")

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

        elif event.type == pygame.KEYDOWN:
            print("key down:", pygame.key.name(event.key))

        elif event.type == pygame.KEYUP:
            print("key up:", pygame.key.name(event.key))

        elif event.type == pygame.MOUSEBUTTONDOWN:
            print("mouse button down:", event.button, "at", event.pos)

        elif event.type == pygame.MOUSEBUTTONUP:
            print("mouse button up:", event.button, "at", event.pos)

        elif event.type == pygame.MOUSEMOTION:
            print("mouse moved to", event.pos)

    screen.fill((30, 30, 30))
    pygame.display.flip()

pygame.quit()
