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
  • 23,859
  • 5
  • 60
  • 99
Tilak Madichetti
  • 4,110
  • 5
  • 34
  • 52

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
  • 2,033
  • 1
  • 16
  • 23
  • Hey thanks for that , but also tell me how to load an image from a hyperlink such as from lorem-pixels website – Tilak Madichetti 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 Madichetti 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
  • 798
  • 6
  • 21