Answer the question
In order to leave comments, you need to log in
Why doesn't image resize in PyGame?
I'm making a simple RPG with an emphasis on the plot, and I just can't cope with this ill-fated background, the fact is that I expand the window to full screen, and I want the image for the menu to also be the size of my screen (and not only mine). But this stubborn one does not want to change its size in any way (
Here is the code:
img_dir = path.join(path.dirname(__file__), 'img')
snd_dir = path.join(path.dirname(__file__), 'snd')
WIDTH = GetSystemMetrics(0)
HEIGHT = GetSystemMetrics(1)
def menu():
global game_over
background = pygame.image.load(path.join(img_dir, 'background_menu.png')).convert()
pygame.transform.scale(background, (WIDTH, HEIGHT))
background_rect = background.get_rect()
start = True
screen.blit(background, (0, 0))
all_sprites.draw(screen)
pygame.display.flip()
while game_over:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
game_over = False
Answer the question
In order to leave comments, you need to log in
Where you enlarge the picture, you forgot to designate the new picture as a variable.
newBackground = pygame.transform.scale(background, (WIDTH, HEIGHT))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question