[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Problem with set_icon - image is distorted on taskbar



When I ran your test script, the window icon stayed as the default one
& didn't change. For the task-bar icon, none of the color-key stuff
was working (i.e. none of the black parts were transparent)

I was able to make the window icon take by calling set_icon before
set_mode (had to get rid of the convert call).

Then to get the color-key to take (so all black pixels were
transparent) I resized the bmp to 32x32.

I attached the resized image, and below is the modified sample code -
does this get the desired results for you?

=============

import pygame
from pygame.locals import *

pygame.init()

icon = pygame.image.load("icon_32.bmp")
icon.set_colorkey((0,0,0))
pygame.display.set_icon(icon)

pygame.display.set_mode((400,300))
pygame.display.set_caption("test")

while 1:
   for event in pygame.event.get():
           if event.type == KEYDOWN:
               if event.key == 27:
                   raise SystemExit
   pygame.display.update()

=============

Attachment: icon_32.bmp
Description: Windows bitmap