1

I have a pygame application that I want to set the taskbar icon for. I have tried

import ctypes

myappid = 'mycompany.myproduct.subproduct.version' # arbitrary string
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

but to no avail. I compiled it into a .exe with cx_Freeze and set the .exe icon there. When I run the program it sets the icon in the taskbar to be the default pygame icon. I have also set the icon for the pygame window with

self.programIcon = pygame.image.load(os.path.join(currentPath, 'images', 'Logos', "railwaycontrollerbg.png"))
pygame.display.set_icon(self.programIcon)

Other info:

  • Python 3.8 (32 bit)
  • Pygame 2.0.0.dev10
  • Windows 10 latest version

Thanks in advance for any help.

Computroniks
  • 85
  • 1
  • 11
  • Does this answer your question? [Changing the application and taskbar icon - Python/Tkinter](https://stackoverflow.com/questions/14900510/changing-the-application-and-taskbar-icon-python-tkinter) – egemenakturk Jul 07 '20 at 09:45
  • This is the same question in [here](https://stackoverflow.com/questions/14900510/changing-the-application-and-taskbar-icon-python-tkinter) . U copied the most voted answer to ask question. I think its not a good thing for StackOverflow. – egemenakturk Jul 07 '20 at 09:46
  • @egemenakturk I tried the answers from that question and they did not work. That is why I included this one here so that people would not suggest it as I had already tried it. – Computroniks Jul 07 '20 at 09:50
  • Changing icon only in cx_freeze won't work. You need to change the icon in pygame window as well. Here is the thread on how to do it in pygame window https://stackoverflow.com/questions/21271059/how-do-i-change-the-pygame-icon – tan_an Jul 07 '20 at 10:45
  • @tan_an Sorry, I forgot to mention that I had already set the window icon for pygame as well. – Computroniks Jul 07 '20 at 10:54
  • Have you specified '.ico' file in cx_freeze setup ? If not try converting your image to ico and then use in cx_freeze – tan_an Jul 07 '20 at 11:01
  • @tan_an The file is saved as favicon.ico already. – Computroniks Jul 07 '20 at 11:12

1 Answers1

1

I figured it out. I believe that the problem was the image I was using was to large. I swapped it out with a 32 x 32 version of the image and it worked perfectly. Thanks for your help.

Computroniks
  • 85
  • 1
  • 11