SDL engine Pygame is based, use the SDL_VIDEO_CENTERED environment variable to indicate that the window should be centered. The variable must be declared before Pygame is started by the init () function.
import pygame
import os
os.environ['SDL_VIDEO_CENTERED'] = '1'
pygame.init()