当我更改图标时,Pyinstaller exe无法正常工作 [英] Pyinstaller exe not working when I change the icon

查看:311
本文介绍了当我更改图标时,Pyinstaller exe无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用python Tkinter制作GUI.它还使用numpy和matplotlib.因此,我使用pyinstaller并使用python脚本制作了一个exe.它运行完美,可以完成我想要的所有操作. 然后,我尝试使用此行从gui窗口(我正在使用Windows 10)中更改tk图标

I was making a GUI with python Tkinter. It also uses numpy and matplotlib also. So, I used pyinstaller and make a exe out of the python script. It runs flawlessly and did all what i wanted. Then I tried to change the tk icon from the gui window (i am using windows 10) with this line

master.iconbitmap(default='image.ico')

除此行外,我对主程序没有任何更改.然后使用pyinstaller,我制作了exe文件,没有任何错误.但是,当我尝试运行exe时,它显示致命错误!file.exe返回-1" 我想念什么?如何解决此问题?

other than this line i change nothing of the main program. Then using pyinstaller and I made the exe without any error. But when I tried to run the exe it shows "Fatal Error! file.exe returned -1" What am i missing? How to fix this problem?

我还有一个额外的问题,我构建的第一个exe文件(不更改图标)在Windows-10和Windows-8上运行,但不在Windows-7中运行.在Windows-7中,它显示相同的错误致命错误!file.exe返回-1"

Also I have an additional problem, the 1st exe i build (without changing the icon) is running on Windows-10 and Windows-8 but not in Windows-7. In windows-7 it shows the same error "Fatal Error! file.exe returned -1"

推荐答案

对于仍然遇到此问题的用户,我发现将iconbitmap行指向完整路径可以解决此问题.在输入.ico文件的完整路径之前,我最初与原始海报存在相同的问题.

For those still experiencing this issue, I found that pointing the iconbitmap line to the full path will resolve the issue. I was originally having the same problem as the original poster until I entered the full path to my .ico file.

示例:

wm_iconbitmap('E:\icon_name.ico')

这篇关于当我更改图标时,Pyinstaller exe无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆