Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transforming images in pygame

Tags:

python

pygame

I'm trying to resize an image in pygame. I want my background image to fill the entire screen. I'd like to setup the entire screen based on the new (stretched) dimensions of the background. The following isn't working and I'm trying to figure out 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()
like image 370
codingJoe Avatar asked Mar 08 '11 03:03

codingJoe


1 Answers

#pygame.transform.scale(background, (1200,800))  #or some size x,y here.
background = pygame.transform.scale(background, (1200,800))
like image 190
tangentstorm Avatar answered Nov 11 '22 18:11

tangentstorm