I have viewed quite a few SO threads on this topic, but none of them have proven very helpful. I am trying to make a single executable file that will run on the system of someone who does not have python installed. My program uses wxpython. Everything else works, but I cannot manage to embed an image inside the exe file (and not just in the dist folder), and load it from the program. I believe that it is possible to do this. How should I do this in my py2exe setup, and how should I access the embedded file from the python program?
Asked
Active
Viewed 1,868 times
0
-
All I know about this, is that it isn't possible to have an .exe from py2exe without the extra baggage files. Although, you can delete about half of them sometimes without any effect. With regards to the image, why do you think it's possible? – Totem Dec 10 '13 at 20:16
-
1You can specify that you want only one file in the py2exe setup program. – trevorKirkby Dec 11 '13 at 01:55
-
I wasn't aware of this.. thanks. If you had a link to docs detailing this, that would be much appreciated – Totem Dec 11 '13 at 12:20
-
here are links to instructions on how to limit to one bundle file with py2exe and another method using pyinstaller(http://stackoverflow.com/questions/112698/py2exe-generate-single-executable-file#113014) -- (http://stackoverflow.com/questions/112698/py2exe-generate-single-executable-file) – Totem Dec 11 '13 at 12:25
-
For py2exe, there is a SO thread on how to do it here (as it happens it appears to be the same thread you referenced me with, it details several methods): http://stackoverflow.com/questions/112698/py2exe-generate-single-executable-file Here is the py2exe docs concerning this (at the time that I found this, it was unable to connect, but it may work by the time you see this): www.py2exe.org/index.cgi/SingleFileExecutable Pyinstaller probably also offers this. The SO thread details that as well. – trevorKirkby Dec 11 '13 at 16:02
1 Answers
2
py2exe may not support this. However, you can use wxPython's img2py utility to convert your image into an importable Python file. Then you should be able to "embed" the images that way. Here are some links on how to use the img2py utility:

Mike Driscoll
- 32,629
- 8
- 45
- 88
-
I have found it quite useful. It is also used in some of the demos in the wxPython demo. – Mike Driscoll Dec 12 '13 at 14:34