Image

Imagesciucaro wrote in Imagepython_dev

PyGame Window Centering

How do I center a Pygame-generated Window when it opens? I don't like that it ends up a little bit off the screen.

I know it can be done in wxPython with a property where on the desktop the window opens centered IIRC, but I searched the PyGame Documentation and the display module for any parameters, and there is no way to center the window on initialization.

I checked this site:

http://osdir.com/ml/python.pygame/2003-11/msg00016.html

Not only is the Python version mentioned really old, but the os.environ code doesn't work.

os.environ['SDL_SET_VIDEO_WINDOW_POS'] = 'center'

Or did I place it in the wrong spot?

Any help is appreciated. I'll also add I'm really beginning to appreciate PyGame more and more, after seeing the games at the site, like "Barbie Seahorse Adventures" and "Natto-Cat", and a few successful tests.