Python 2.7
Install a 32-bit version of Python 2.7. At the time of writing, this was 2.7.6. The default installation location is sufficient. Make sure the "python" command is usable from the command line.
pywin32
http://sourceforge.net/projects/pywin32/
pywin32 provides a graphical installer which will detect your Python installation directory. No options should be presented, and it should install without issue. This library is required to properly bundle our application for distrubition.
PyInstaller
PyInstaller will be used later to bundle our application. If Python has been added to your system path correctly, this should work fine.
python setup.py install
py-sdl2
https://bitbucket.org/marcusva/py-sdl2/downloads
py-sdl2 provides ctypes bindings to SDL2. This should install fine without having the actual SDL2 libraries present on your system.
python setup.py install
SDL2
http://www.libsdl.org/download-2.0.php
http://www.libsdl.org/projects/SDL_image/
http://www.libsdl.org/projects/SDL_mixer/
http://www.libsdl.org/projects/SDL_ttf/
Download all Windows 32-bit runtime libraries. Once unzipped, copy all of the DLL's into a folder named lib
under your project root - as a sibling to demo.py
.
During development, there's nothing abnormal about this setup. The SDL2 and Python documentation should be very nearly sufficient to build your demonstration. To run your program, simply use:
python demo.py
Now that our demo is running, we can package everything up by running the PyInstaller script.
pyinstaller demo.spec
The spec file will locate all DLL's for us and scan our demo.py file for other included libraries. It will also detect and bundle the required Microsoft runtime manifest and DLL's. Once built, you can reach into the dist
directory, create an archive of the demo
folder and hand it to anyone running a newish version of Windows.
The final directory structure will look like this:
/my_demo
demo.py
demo.spec
/build
/demo
demo.exe.manifest
...
/dist
/demo
/include
/lib
SDL2.dll
SDL2_image.dll
...
_ctypes.pyd
_hashlib.pyd
...
demo.exe
/lib
SDL2.dll
SDL2_image.dll
...
The important directory here is: /my_demo/dist/demo
, which you will zip and distribute.