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

Re: [pygame] pygame.display.set_caption() not setting window icon



On 7/9/06, David Mikesell <dave_mikesell@xxxxxxxxxxx> wrote:
I'm using Pygame 1.7.1 on Windows XP.   set_icon sets the icon when the
window is collapsed, set_caption sets the caption, and get_caption shows
the correct file name of the icontitle.  Anyone else having problems
with this?

I don't think set_caption is supposed to set the icon... the
"icontitle" is not a path to an icon, it's a title when iconified

from the pygame docs:
"If the display has a window title, this function will change the name
on the window. Some systems support an alternate shorter title to be
used for minimized displays."

the sdl docs suck for this function...

I don't know what systems support that shorter title (my WinXP SP2
doesn't seem to)


__screen__ = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
icon = load_image("frantic.png")
pygame.display.set_icon(icon)
pygame.display.set_caption("Frantic", get_image_file("frantic.png"))

looking at this code though, it only sets the icon on the task bar,
and not in the window's title bar on WinXP... which I presume is why
you were thinking you are supposed to set the icon with the
set_caption call?

In order to get the icon to take properly, you need to call set_icon
before set_mode, but you need to call it after display.init or it may
crash...

this code sets the icon in both the taskbar and window for me:
--------------
pygame.init()
icon = pygame.image.load("frantic.png")
pygame.display.set_icon(icon)
__screen__ = pygame.display.set_mode((800, 600))
pygame.display.set_caption("It only uses this caption title for me",
"NotUsed4Me")
------------------------

from the pygame docs:
"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 -
initialize a window or creen for display to create the icon before the
display mode is set."

the sdl docs confirm this:
"This function must be called before the first call to SDL_SetVideoMode."