简体   繁体   English

Python PyQt5如何更改最小化图标

[英]Python PyQt5 how to change minimized icon

I converted a Python script to an executable ( .exe ) via PyInstaller. 我通过PyInstaller将Python脚本转换为可执行文件( .exe )。 I would like to change minimized icon (See the picture below) 我想更改最小化图标(请参见下图)

栏上的最小化图标 I searched for it but couldn't find a solution in PyQt5 nor PyInstaller. 我搜索了它,但是在PyQt5或PyInstaller中都找不到解决方案。

How can I change that symbol to a .png or .ico that I choose? 如何将该符号更改为我选择的.png或.ico? Is there a command like --icon ico.png in PyInstaller for minimized icon? --icon ico.png中是否有类似--icon ico.png的命令用于最小化图标?

You need to run the pyinstaller on a .spec file. 您需要在.spec文件上运行pyinstaller。 Best way to create a .spec file is to run the installer on your main py file, it will spit out a .spec file. 创建.spec文件的最佳方法是在主py文件上运行安装程序,它将吐出.spec文件。

Inside the .spec file, in the EXE tuple, you need to include icon='c:\\\\app\\\\icon.ico' 在.spec文件中的EXE元组中,您需要包含icon='c:\\\\app\\\\icon.ico'

'icon.ico' as your icon file. “ icon.ico”作为您的图标文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM