Why does my pygame program slowdown, when I move my mouse?

You want to be setting up a pygame.time.Clock() and in your event loop be calling clock.tick(60) (for 60fps).

Right now your loop is input-bound and not FPS-bound.

  • In Pygame, normalizing game-speed across different fps values
  • pygame clock.tick() vs framerate in game main loop