python 3.x - Can't set an icon on Pygame using a .png file -


first, load icon image:

icon = pygame.image.load ('apple2.png')

then set icon using set_icon method:

pygame.display.set_icon (icon)

i run script, , icon not visible.

it shows instead:

small icon of box blue bar.

this may because on operating systems must set icon before defining display. if set after defining display, may end have.

"some systems not allow window icon change after has been shown." -pygame docs (http://pygame.org/docs/ref/display.html#pygame.display.set_icon)

if starts work icon doesn't way expect it, try making icon 16x16 or 8x8 , resizing 256x256(this may apply windows).


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -