Sign in to follow this  

Images with pygame and py2exe

This topic is 2843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello. I have a pygame script that I'm trying to package as a single executable file. Is there a way to include the relevant image files in the exe itself? So far, all the examples I've seen have put their images in a separate data folder, which would make distribution a little more complicated. Thanks for any advice!

Share this post


Link to post
Share on other sites
Heya,

I was pondering this myself about a month ago, when I was setting up distribution for a dinky little pyglet game I was (and still am) working on. Most of the people on the internet who ask this get a vague reply, or one that misses the mark.

What I found is that it's indeed possible to pack your own data in the EXE, but I've yet to actually try it out myself, so your mileage may vary. You'll have to build your own extractor for the images, to convert them to files (or maybe even just work with them in binary format, if you're so inclined...) at runtime.

If you do end up doing that, let me know how it goes, because I've yet to implement it myself, and would be interested in hearing how it went, and maybe seeing some code if you're feeling generous. I'll probably end up implementing something myself before long, and will let you know.

Share this post


Link to post
Share on other sites
Thanks, Andrew! I'll look that over, and post back if anything useful comes of it. I'd be very interested to hear about your results, too.

Share this post


Link to post
Share on other sites

This topic is 2843 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this