0

I am making use of pygame module to make games but how do I change the default icon that appears on the Title Bar.

I am using Python 3.4.

Peter Wood
  • 22,682
  • 5
  • 57
  • 94
Tilak Maddy
  • 3,505
  • 2
  • 32
  • 49

2 Answers2

7

To set the icon, you first need to load the image.

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

Next you use the image which you loaded, and set it as the icon.

pygame.display.set_icon(icon)
Shahzad
  • 1,788
  • 1
  • 14
  • 22
  • Hey thanks for that , but also tell me how to load an image from a hyperlink such as from lorem-pixels website – Tilak Maddy Oct 22 '15 at 10:49
  • @TilakMadichetti I'm not sure how you would do this with pygame, but take a look at [this](http://stackoverflow.com/questions/7391945/how-do-i-read-image-data-from-a-url-in-python). – Shahzad Oct 22 '15 at 10:57
  • That was exactly what I was looking for .. Thanks Bud !! Now you don't need to be "not sure" with your answer – Tilak Maddy Oct 22 '15 at 10:59
  • 1
    @TilakMadichetti Glad I could help. We both learnt something new :) – Shahzad Oct 22 '15 at 11:02
1

Have you tried set_icon()? Never used pygame before but it seems the way to go.

Lucas Infante
  • 749
  • 5
  • 20