python - 打开文件时如何在pyinstaller中添加自己的图标
问题描述
当我通过 pyinstaller 将我的 python 文件编译为 exe 时。我在想有没有办法在打开文件时添加自己的自定义图标。
就像我打开文件时看到的一样:
那么如何解决这个问题。我想添加自己的徽标
解决方案
在您的应用程序代码中,添加以下内容:
root.iconbitmap("path_to_icon.ico")
whereroot
是分配给的变量,Tk()
是path_to_icon.ico
存储图标的路径。
.
使用 pyinstaller 时,添加标志--icon="path_to_icon.ico"
例子:
pyinstaller my_program.py --icon="icon.ico"
推荐阅读
- spring-boot - 使用 SQLite 数据库的简单 SpringBoot CRUD 应用程序
- linux - tcpdump 捕获在 10 分钟后停止
- javascript - Cypress.io - 从 `then` 输入输入
- multithreading - 异步编程中的线程与基于事件的方法
- java - BuildLabel 属性是如何生成的?
- extjs - 如何在 ExtJS 中重新排序网格?
- javascript - 从 Json 对象获取数组中的值
- css - 在grid-row css3之后有border-bottom
- node.js - 使用 React Native 和 Nodejs Express Multer 上传图片
- kotlin - 如何在 Kotlin 中反转字符串的大小写?