Author Topic: Setting icon in Pygame window  (Read 5417 times)

0 Members and 1 Guest are viewing this topic.

Offline GooberTron

  • Regular Member
  • *
  • Join Date: Oct 2012
  • Posts: 5
  • Karma: 0
Setting icon in Pygame window
« on: November 11, 2012, 03:18:33 PM »
Hi,

I'm plodding through the book, great fun!
I'm finding the pygame website and comments a bit confusing though.
I wanted to try changing the snakey logo in the top left of the game display.

I reckon you should be able to do this via;

icon = pygame.image.load("icon.bmp").convert_alpha()       
pygame.display.set_icon(icon)

The pygame website suggests doing this before you set the display mode (e.g.);
screen = pygame.display.set_mode((500,500))

It seems to work after the set_mode o.k. but if I put the code before it I get;
pygame.error: No video mode has been set

Which kind of contradicts the website unless I have totally misunderstood!



Offline twobitcoder

  • Administrator
  • -[ EPIC MEMBER ]-
  • *****
  • Join Date: Mar 2007
  • Posts: 4,926
  • Karma: 69
    • jharbour.com
  • Game: Adventure
  • Genre: RPG
  • Platform: Atari
  • Studio: Activision
Re: Setting icon in Pygame window
« Reply #1 on: November 15, 2012, 10:39:44 AM »
Whatever works!