我正在使用Python的PyQt4开发应用程序,却找不到如何更改任务栏图标的方法.我在Qt的Designer中制作了.ui文件,可以在其中更改windowIcon属性.但这不是我想要的.我想在Windows任务栏中更改应用程序图标的外观.现在,它是窗口图标中的Python徽标.
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.
我在SO上找到了一些信息:链接,但这对我没有帮助很多.
I found some information on SO: link but it's not helping me much.
我尝试过:
app = QtGui.QApplication([]) app.setWindowIcon(QtGui.QIcon('chip_icon_normal.png')) app.exec_()但是图标保持不变.
我要更改的内容,显示图片: (这是通过在主窗口/对话框或应用程序上调用setWindowIcon来完成的,如上所示.)
What i want to change, showing the picture: (This is done calling the setWindowIcon on main window/ dialog, or the application, as shown above.)
推荐答案
此问题是由Windows平台上任务栏图标的处理方式的某些特殊性引起的.
This problem is caused by some peculiarities in how taskbar icons are handled on the Windows platform.
有关详细信息,请参见此答案,以及使用ctypes的解决方法.
See this answer for details, along with a workaround using ctypes.
更多推荐
在PyQt中设置Windows任务栏图标
发布评论