pyinstaller does not show images and icon

pyinstaller, python, tkinter

Solution

Put the `.ico` & `.jpg` files in the folder that `pyinstaller` created.

Problem

I read many tutorials on how to include image and icons by modifying the spec file though I couldn't succeed.I wrote a program which I want to make executable using pyinstaller and run it on other computers. pyinstaller doesnot include image and icon files on the main .exe file. When I run the compiled .exe file on my own pc it works just fine but when I try to run the same file on other computer, it throws an error.. Please suggest me how do I do it, this is driving off my brain.. Thanks in advance.. below is my .spec file code and my python script(partial) .spec file: ``` # -*- mode: python -*- a = Analysis(['English-Nepali.py'], pathex=['C:\\Users\\User\\Desktop\\Dict'], hiddenimports=[], hookspath=None, runtime_hooks=None) pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts, exclude_binaries=True, name='English-Nepali.exe', debug=False, strip=None, upx=True, console=True ) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=None, upx=True, name='English-Nepali') ``` part of the program where image and icon is used, both ico and jpg files are present in the directory: ``` class Demo2: def __init__(self, master): self.master = master self.master.geometry("640x250+200+200") master.resizable(False,False) self.master.title('About') self.img = Image.open(r"C:\Users\User\Desktop\Dict\rotunda.jpg") self.tetras = ImageTk.PhotoImage(self.img) def main(): root = tk.Tk() ex = Example(root) root.iconbitmap(r"C:\Users\User\Desktop\Dict\1.ico") root.resizable(False,False) root.mainloop() ```

Original source