所以我尝试更改 pygame 的图标,但它没有改变,只显示默认的蛇。我用另一个 Logo 尝试过,它有效,但我不明白为什么那个有效,而我想要的却无效。有人可以帮忙吗?
代码:
gameIcon = pygame.image.load('path\\icon.png')
pygame.display.set_icon(gameIcon)
谢谢!
顺便说一句,图像尺寸为 200x200,有效的尺寸为 512x512
最佳答案
[...] 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.
设置pygame.display.set_mode()
之前的图标:
gameIcon = pygame.image.load('path\\icon.png')
pygame.display.set_icon(gameIcon)
screen = pygame.display.set_mode((width, height))
关于python - Pygame Logo 没有改变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66576606/