# Positioning a Window to Fill the Screen

I'm using Pygame (just started), and I'm struggling to find how I set the position of the window to fill my entire monitor screen.

I can move things around within the screen / surface. I can make the screen the right size to fill my monitor (can drag it with my mouse to the right place), but can't find how to set the top-left corner of the surface to the top-left corner of my monitor. I'm using sprites.

I haven't tried that but a web search suggests that you need to use the underlying SDL layer to achieve this.

You need to set an environment variable before you initialize the window:

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))


(Source)

Now, if you want to have the app running in fullscreen, there is another way to do that: use pygame.FULLSCREEN flag when calling set_mode:

pygame.display.set_mode((0, 0), pygame.FULLSCREEN)


More details on StackOverflow, and in the official documentation.

• Thank You, haven't tried setting the environment variable yet but the pygame.FULLSCREEN command works a treat. Cheers – ffrippy Nov 7 '19 at 15:09
• Many thanks, setting the environmental variable works very nicely as well. ffrippy – ffrippy Nov 8 '19 at 10:19