Can I set display screen position?

Can I set display screen position?

Postby dboxall123 » Sat Aug 03, 2013 3:55 pm

Hi everyone! This really annoying me. Whenever I run a game, the window opens too far down so that the bottom part of my screen actually goes off of the computer screen. So every time I run a game I have to drag it up to the center. I know it's not really that much of a problem, but it's really annoying. I looked in the options for IDLE hoping that there would be an option to change this, but there isn't. Does anyone now how I can change this?
Thanks!
Dan
dboxall123
 
Posts: 110
Joined: Fri Jul 12, 2013 5:28 pm

Re: Can I set display screen position?

Postby Mekire » Sat Aug 03, 2013 4:28 pm

If we are talking about a pygame program here, you can add this line before you initialize the display:
Code: Select all
os.environ['SDL_VIDEO_CENTERED'] = '1'

That will make your window appear in the center of the screen. If you would rather have your window appear in a specific place instead, you can do this:
Code: Select all
os.environ['SDL_VIDEO_WINDOW_POS'] = "350,150"
setting the string to whatever coordinates you want.

You will, of course, have to import the os module.
-Mek
User avatar
Mekire
 
Posts: 1031
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: Can I set display screen position?

Postby dboxall123 » Sun Aug 04, 2013 1:02 am

Sweet, thanks Mek! Much appreciated
Dan
dboxall123
 
Posts: 110
Joined: Fri Jul 12, 2013 5:28 pm


Return to Game Development

Who is online

Users browsing this forum: No registered users and 2 guests