how to open window in middle of screen in pygame code example
Example 1: python center window
import os
os.environ["SDL_VIDEO_CENTERED"] = "1"
Example 2: pygame window at center
import pygame, os
os.environ['SDL_VIDEO_CENTERED'] = '1'
# This has to be done before you initialise pygame with pygame.init()