Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/361.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python PyInstaller在创建exe文件时未显示.png img_Python_Tkinter_Pyinstaller - Fatal编程技术网

Python PyInstaller在创建exe文件时未显示.png img

Python PyInstaller在创建exe文件时未显示.png img,python,tkinter,pyinstaller,Python,Tkinter,Pyinstaller,我有一个使用Tkinter创建GUI的代码,但当我尝试运行PyInstaller并创建exe文件时,应用程序中缺少.png图像: self.logo = PhotoImage(file = 'img01.png') ttk.Label(self.frame_header, image = self.logo, ).grid(row = 0, column = 0, rowspan = 2) ttk.Label(self.frame_header, text = 'Static Data A

我有一个使用Tkinter创建GUI的代码,但当我尝试运行PyInstaller并创建exe文件时,应用程序中缺少.png图像:

self.logo = PhotoImage(file = 'img01.png')

ttk.Label(self.frame_header, image = self.logo, ).grid(row = 0, column = 0, 
rowspan = 2)

ttk.Label(self.frame_header, text = 'Static Data App!',style = 
'Header.TLabel').grid(row = 0, column = 1)

ttk.Label(self.frame_header, wraplength = 400,
text = ("Just click on the buttons one by one and follow the 
logic")).grid(row = 1, column = 1)

ttk.Label(self.frame_header, image = self.logo, ).grid(row = 0, column = 3, 
rowspan = 2)

self.frame_content = ttk.Frame(master)
self.frame_content.pack()

当我尝试运行exe文件时,我收到的输出是“img.png没有这样的文件od目录”,即使当我从脚本运行我的应用程序时会显示img。

是否将图像文件夹复制到.exe所在的dist文件夹?

。。。我只是试着把img放在我的exe文件所在的同一个文件夹中,它工作了。。。谢谢@adejongh93