Convert images to pygame

I am trying to resize an image in pygame. I want my background image to fill the entire screen. I would like to adjust the whole screen based on the new (stretched) background sizes. The following do not work, and I am trying to understand why.

Suggestions?

background = pygame.image.load("data/stars.bmp")
pygame.transform.scale(background, (1200,800))  #or some size x,y here.
bgRect = background.get_rect()
size = width, height = bgRect.width, bgRect.height
screen = pygame.display.set_mode(size)
screen.blit(background, bgRect)
pygame.display.flip()
+5
source share
1 answer
#pygame.transform.scale(background, (1200,800))  #or some size x,y here.
background = pygame.transform.scale(background, (1200,800))
+7
source

All Articles