|
CS 121 -- Fall 2012Creating a Python Executable |
The code for using py2exe. Note: read all the comments, especially the one about saving a copy of you python code prior to creating the executable. Basically, you put the above code in a Python file in the same folder as the game. Change self.script to be the name of your primary Python file (e.g. "main.py"). self.extra_datas also has to be changed to include images, music, custom fonts, etc. self.script will accept folder names. So, for example, if all of your images are in a folder called "images" and all the music is in a folder called "sounds", the line should be self.extra_datas = ["images", "sounds"]. An official py2app tutorial . The tutorial recommends using py2applet, a py2app terminal command that theoretically does all of the work. If it does not work, it is pretty simple to handwrite the script generated by py2applet. Here's the one used for Binary Bubbles:
Usage:
python setup.py py2app
from setuptools import setup
APP = ['BBuilder.py']
DATA_FILES = ['fonts', 'images', 'sounds']
OPTIONS = {'argv_emulation': False}
setup(
app=APP,
name='BBuilder',
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
When all else fails, try Googling.
Last Modified Tuesday, 06-Nov-2012 14:05:14 PST