While running my program the icon I configured with pygame.display.set_icon(icon)
displays only in the window. In the taskbar the default python icon remains the same.
Is there a way to change that?
Source:
import pygame
from pygame.locals import *
import sys, os
import time
pygame.init()
# Load Images
try:
bg = os.getcwd() + '\\images\\background.png'
background = pygame.image.load(bg).convert()
except:
print 'Error: Could not find background.png'
try:
logo = os.getcwd() + '\\images\\logo.png'
c_logo = pygame.image.load(logo).convert()
except:
print 'Error: Could not find logo.png'
try:
about_dialog_infile = os.getcwd() + '\\images\\about_dialog[alpha].png'
about_dialog = pygame.image.load(about_dialog_infile).convert_alpha()
except:
pass
i_icon = os.getcwd() + '\\images\\icon.png'
icon = pygame.image.load(i_icon)
pygame.display.set_icon(icon)
pygame.display.set_caption("Test program")
screenSize =(640,480)
screen = pygame.display.set_mode(screenSize,0,32)
pygame.display.set_caption('My Test Program')
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
# sys.exit()
if event.type == MOUSEBUTTONDOWN:
check_click(about, event.pos)
screen.blit(background, (0,0))
pygame.display.update()
I finally figured it out.
As far as I can tell, the only way to actually set that icon in the taskbar is during packaging.
With pyinstaller for example, you would call python pyinstaller.py --icon=icon.ico
Where icon is the icon you want displayed in the task bar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With