Setting the Windows taskbar icon in PyQt(在 PyQt 中设置 Windows 任务栏图标)
问题描述
我正在 Python 的 PyQt4 中开发一个应用程序,但找不到如何更改任务栏图标.我在 Qt 的设计器中创建了我的 .ui 文件,我可以在其中更改 windowIcon
属性.但这不是我要找的.我想更改 Windows 任务栏中应用程序图标的外观.现在它是窗口图标中的 Python 标志.
我找到了一些关于 SO 的信息:了解详情,以及使用 ctypes
的解决方法.
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.)
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
.
这篇关于在 PyQt 中设置 Windows 任务栏图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 PyQt 中设置 Windows 任务栏图标


基础教程推荐
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 筛选NumPy数组 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01