import pygame, os os.environ['SDL_VIDEO_CENTERED'] = '1' # This has to be done before you initialise pygame with pygame.init()