Saturday, October 8, 2022
HomeGame Developmentpython - Pygame.show.set_icon unable to indicate transparecy

python – Pygame.show.set_icon unable to indicate transparecy


On Windows 10, utilizing Pygame 1.9.6, I’ve discovered that every one I must do is to scale my PNG picture to match an allowed Windows icon measurement. For instance, with my 80×80 picture, I do:

icon = pygame.picture.load(ICON_FILENAME)
icon = pygame.rework.smoothscale(icon, (96, 96))
pygame.show.set_icon(icon)

If you are solely utilizing the picture as an icon (and never planning to reuse the picture object), you don’t want to name picture.convert() or picture.convert_alpha(). In reality, I’d advocate setting your icon as early as attainable, even earlier than you name pygame.show.set_mode(), and convert() or convert_alpha() will fail if you happen to name them that early.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments