Setting the Windows taskbar icon in PyQt

Marko picture Marko · Sep 15, 2012 · Viewed 48.1k times · Source

I'm working on an applcation in Python's PyQt4 and cannot find how to change the taskbar icon. I made my .ui files in Qt's Designer, where I can change the windowIcon properties. But that is not what I am looking for. I want to change the look of the application's icon in windows taskbar. For now it is Python logo in a window icon.

I found some information on SO: link but it's not helping me much.

I tried:

app = QtGui.QApplication([])
app.setWindowIcon(QtGui.QIcon('chip_icon_normal.png'))
app.exec_()

But the icon remains unchanged.

What i want to change, showing the picture: (This is done calling the setWindowIcon on main window/ dialog, or the application, as shown above.)

Taskbar icon change

Answer

ekhumoro picture ekhumoro · Sep 21, 2012

This problem is caused by some peculiarities in how taskbar icons are handled on the Windows platform.

See this answer for details, along with a workaround using ctypes.