I am creating a game using pygame 1.9.6. But, as you can see by running this simple example, some black borders appear around the window, even with the FULLSCREEN
flag.
import pygame
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((900, 500), FULLSCREEN)
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
exit()
screen.fill((255, 255, 255))
pygame.display.flip()
I tried to add the flag NOFRAME
in the screen initialisation, but it didn't work.
I wonder if it is possible to remove the border, for example by increasing the screen size to just fit in the current screen. But I also want to keep the 900x500
resolution.
Can pygame
resize the entire screen? Do I have to blit()
everything on a Surface
, then rescale it and draw it on the actual screen?
Thanks @Glenn Mackintosh
!
The best way to remove the black border is actually to add the SCALED
flag in the screen declaration like this:
screen = pygame.display.set_mode((900, 500), FULLSCREEN|SCALED)
But to use it, the pygame version 2.0.0
or more is required.
It seems that now this issue is fixed in more recent pygame versions, the game window is now resized to maximize used space by default.