Pygame logo doesn't change

Viewed 161

So I tried to change the icon for pygame and it doesn't change, just shows the default snake. I tried it with another logo and it works, but I can't figure out why that one works and the one I want doesn't. Can someone help?

Code:

gameIcon = pygame.image.load('path\\icon.png')

pygame.display.set_icon(gameIcon)

Thanks!

btw image size 200x200, the one that works is 512x512

2 Answers

See pygame.display.set_icon():

[...] Some systems do not allow the window icon to change after it has been shown. This function can be called before pygame.display.set_mode() to create the icon before the display mode is set.

Set the icon before pygame.display.set_mode():

gameIcon = pygame.image.load('path\\icon.png')
pygame.display.set_icon(gameIcon)

screen = pygame.display.set_mode((width, height))

Okay, so I resized the icon image to 512x512 and it works now. Thank you so much!

Related