Pygame2exe is a script that can be used to create Windows executables from games written with Pygame.
The output is a single ‘dist’ directory containing all the files needed to run the game.
No installation is required in order to run the executable produced.
The script includes additional resources such as the standard font.
In addition, the script has a list of Python modules to ignore in order to reduce the file size of the executable produced.
The average file size of the zipped distribution folder for a game with minimal resource data is around 4MB.
Source:
The source for the pygame2exe script can be found in this GitHub repository.
https://github.com/flembobs/pygame2exe
Requirements:
The script relies on py2exe. Use the relevant version for your Python installation.
I have used this script along with Python 2.7 and Pygame for my games.
How to Use:
Place the pygame2exe.py script in the same directory as the script used to launch your pygame game.
Update the variables in the ‘Global Data’ section of the script to suit your game.
Run pygame2exe.py script. A ‘dist’ directory will be created containing all the files needed to run your game.
The games created can be run without installation.