Skip to main content

SettingWindowPosition — wiki

You can set the position of the window by using SDL environment variables before you initialise pygame. Environment variables can be set with the os.environ dict in python.

x = 100
y = 0
import os
os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" % (x,y)

import pygame
pygame.init()
screen = pygame.display.set_mode((100,100))

# wait for a while to show the window.
import time
time.sleep(2)
A full list of SDL environment variables can be found here:
http://www.libsdl.org/cgi/docwiki.cgi/Environment_20variables

newer link
https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlenvvars.html