[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] controlling window position



Matt Ficken wrote:
when creating a pygame window, how can is location on the screen be controlled?
before creating the window, you can try to get SDL to help you by setting some environment variables. if you just want a centered window, you can usually just set the SDL_VIDEO_CENTERED variable. also the X and Win displays support SDL_VIDEO_WINDOW_POS.

os.environ['SDL_VIDEO_CENTERED'] = 'anything'
os.environ['SDL_VIDEO_WINDOW_POS'] = '200,200'

those lines before display.set_mode() are your only ways to control the window position, but they won't always work on all platforms.