First, you need a Python script for py2exe. I name it setup. py and the content is as follows:
1 From Distutils. Core Import Setup
2 Import Glob, shutil
3 Import Py2exe
4 Setup (Windows = [ " Main. py " ])
5 Shutil. copytree ( ' SFX ' , ' Dist/SFX ' )
6 Shutil. copytree ( ' Image ' , ' Dist/Image ' )
7 Shutil. copyfile ( ' C:/python25/lib/Site-packages/pygame/freesansbold. TTF ' , ' Dist/freesansbold. TTF ' )
And simple processing of Main. py
1 # Font = pygame. Font. Font (none, 40)
2 Font = Pygame. Font. Font ( ' Freesansbold. TTF ' , 40 )
Finally, run the following command:
Python setup. py py2exe
........................................ .................
About py2exe
Introduction
Py2exe isPython DistutilsExtension which converts Python scripts into executable Windows programs, able to run without requiring a python installation.
Download
Http://sourceforge.net/projects/py2exe/