python-page

python and
macromedia director > 7 for win

version 0.85

 

history | ToDo | structure | files | tarball/zip | Example | disclaimer

 

History:

While developing a huge multimedia-project with Macromedia Director I missed some important features. Since OpenSource software is what I prefer and speed was not too much of an the issue, I found the XPython-Xtra by Steve Spicklemire. Though the Python-Xtra worked very well with the authoring tool, the inclusion into Projector-Files was not as easily possible.

Finally I worked out a file-structure which provides the expected results (see below).

My first unsuccessful attempts did not regard the fact that the XPython-Xtra needs some standard modules to be imported (e.g. traceback), and I did not include them in the Projector-filestructure, so on a system with no installed Python those modules were not found.

 

ToDo:

 

Structure (suggested in mmsite.py):

filename      directory       explanation
         
projector.exe   .   projector
python15.dll   .   main python-dll
mmsite.py   .   changing sys.path in projector-mode

  ./lib   python standard modules
    ./DLLs   python compiled modules
(PyWinTypes.dll, parser.pyd etc.)
    ./site   user modules (suggestion)
         
         

 

Restrictions:

Presently I am working with Python 1.5.2 for Windows and Macromedia Director 8 for Windows -- I don't know whether Python 1.6 or 2.0 is supported, but Director 7 for Windows is happy with the XPython-Xtra as well. Perhaps recompiling the sources will do the trick for 1.6 and 2.0.

As documented by Steve Spicklemire, the author of the XPython-Xtra, only lists consisting of chars, ints and floats can be used by the interface. It is, however, no problem to write python/lingo code for use on the respective part of the interface to transform these lists (e.g. into dictionaries resp. property lists). Furthermore, these lists, chars etc. are restricted in length: only a string of max. 256 chars can be fed into the Python-Interface with Py_Execute.

When working in authoring mode of director (not running a projector) Python module imports can be misleading: it depends where your Python lives and how sys.path is set. You can easily import/reload modules, but for inclusion into a projector-structure you should copy your user-module into the /site directory of the projector.exe. mmsite.py is set up to add this to sys.path; mmsite.py is imported in projector mode only. Feel free to change mmsite.py to whatever paths you want to include. While working in author mode you can put your module somewhere on the python path.

 

Files:

XPython.x32, python15.dll, PyWinTypes.dll

mmsite.py (assures that correct versions of python modules are imported, sets the path accordingly) -- mmsite.py

pylib.cst (some lingo helper functions for easier use of the Python-Xtra with director, could be copied into the /Lib-directory of the Director Installation to be available as library item -- this is a work in progress)

 

Tarball/Zip:

containing XPython.x32, mmsite.py and pylib.cst -- everything else can be extracted from the python distribution -- find py_xtra_setup.zip here.

 

Disclaimer:

Use this at your own risk. GPL License. According to its author, in production environments XPython should not be relied on.

 

Visitors: (since Aug 2000 ) -- Date: Oct 16, 2002, jbekesi@meta-ware.at