There are plenty of great answers to questions about making a standalone executable, but I can't figure out how to pack art assets (or dynamically loaded files) into it as well. Why would I want to do this? Because it would be great to distribute a simple (throw away) game that开发者_开发问答 lives entirely in a single executable with no installer.
As far as I can tell from searching, there are two basic approaches.
1) Avoid art assets in favor of content generation. I could have a program that turns a simple sprite into a RLE pixel-color list that lives in a python script. Since it's a script, it would get bound up into the exe with a packaging tool. Right?
2) Use some kind of self-extracting archive that can dump the directory structure into a temp directory (or maybe into memory?), then automatically run the entry point of the program.
Does what I'm trying to do make sense? The second option seems so much more sensible, but I'm not sure which tools would be used to accomplish it with python and pygame. I've used py2exe, but it only packaged python scripts and imported modules.
EDIT:
This thread makes me think that you can tell the packaging utility to include program data along with the dependencies. Is that true?
Game development is not field of expertise, but if you haven't already checked out py2exe, I would strongly recommend that you do. It seems to me that any and all scripting import statements will be taken care of by py2exe.
Hope this helps
精彩评论