I'm writing a widget with tkinter to emulate some search bars ( like google / champion select etc . ) within the widget there are some images. These images are in the same folder where I have my file .py and their path is C:\Users\HANZO\Desktop\tools\google.gif etc . till here the program works as intended
Now I tried to get the .exe through py2exe with this setup.py:
from distutils.core import setup
import py2exe
Mydata_files = [('images', ['C:\Users\HANZO\Desktop\tool\google.gif'], ['C:\Users\HANZO\Desktop\tool\champ.gif'])]
setup(
windows = [
{
"script": "multisearch.py",
"icon_resources": [(1, "search.ico")]
}
],
data_file=Mydata_files,
)
when I run the exe it runs as intended , but if I take the whole dist folder and move to another computer the .exe file gives me error saying it can not find the path c:\user\HANZO\desktop\tool\google.gif
and it is obvious that gives me error if it still use the old path. I assumed that my setup.py to include images in the lib folder, or something similar. I'm a noob both py2exe that tkinter.
how should I handle these images ?
tkinterprograms that I've compiled is that instead of specifying a specific path on your computer, which won't work when copied to another computer is to simply specify the image such asimage = "google.gif"which will grab the image out of the current directory, and then simply copy the images into thedistfolder. - user4746908