dmueller
dmueller

Reputation: 61

Python exe created with PyInstaller shows custom icon in Windows Explorer but not in Taskbar when executed

I have written a Python desktop application using PyQt5 for the UI. I create the exe file using PyInstaller from inside PyCharm with the following options: --onefile --windowed --icon=QRev.ico QRev.py

The resulting exe has the QRev.ico icon when viewed in Windows Explorer but when executed a generic or perhaps the PyInstaller icon appears in the Windows 10 taskbar rather than the QRev Icon.

If I pin QRev.exe to the taskbar the icon works as expected. The problem occurs when the exe is executed from anywhere other than the taskbar, the icon in the taskbar is not correct. How can I fix this so that the QRev icon is shown in the taskbar?

Upvotes: 1

Views: 3457

Answers (1)

dmueller
dmueller

Reputation: 61

Finally figure it out after a friend found a similar post for Tkinter.

The icon in the taskbar comes from inside the code not from PyInstaller. For pyqt5 I simply added the command: self.setWindowIcon(QtGui.QIcon('QRev.ico'))

Upvotes: 2

Related Questions