In order to use the image, I use the following commands
bg = Photo Image(file = "DNA.png")
label1 = Label(window, image = bg)
label1.place(x = 0, y = 0)
window.iconbitmap('DNAChain.ico')
And everything works fine until I make it out of it.exe file via pip In the program, I use 2 images, one for the background and the second for the program icon, using pip to create a program.exe
D:\Python>pyinstaller --noconsole project.py --icon=D:\Python\NA Chai.icon
After creating it, I get the following error when running it
I'm a beginner, so I didn't come up with anything smarter than just transferring files to the dist or build foldersenter image description here
If it cannot find the image, then the image is not in the same root folder as its being told it is in your code. So unless you have a typo, the solution would be to have a root folder 'Project' a folder in the root folder 'dist' containing the image and then your 'Project.py' in that root folder as a sibling of the 'dist' folder. Also, I would recommend separating images and fonts into a different folder named 'assets' for the sake of organization instead of having it all in one dist folder.