Python extension modules

The HippoDraw library can be used with the Python programming language.

To do that, a Python extension module is built so that the C++ classes appear as Python classes. Two different extension modules can be built and they have a different interface. The first is Python extension module tutorial designed to for interactive use or from a Python script This is the hippo Python extension module. With it, HippoDraw can be manipulated interactively or via scripts written in Python. The second, is Python extension module: sihippo designed for use with PyQt. It is the sihippo Python extension module. The two uses are quite different and thus the interface is different.

For interactive use of HippoDraw, the Boost.Python package is used to build the extension module. Version 2 of Boost.Python is required. It is distributed as part of the Boost distribution since version 1.29.0. This version is simpler and has less problems with common C++ compilers then version 1. The source code for building the Python extension module with Boost.Python is in the python subdirectory.

To write applications using Qt with Python, the PyQt package can be used. PyQt uses the SIP package to build the Python extension module. Before SIP version 4, SIP and Boost.Python appeared to be incompatible (see the discussion in PyKDE and Python C++-sig mailing list archives). This maybe fixed with version 4, but it has not been tested. Thus, HippoDraw has an Python extension module built with SIP as well. All the sip interface sources are in the sip subdirectory.

Note that the Python extension modules built with Boost.Python seem to be compatible with ones build with SWIG . As there are many more Python extension modules built with SWIG or Boost.Python than with SIP, the Boost.Python built module for HippoDraw is always built, while the SIP one is optional.


Generated for HippoDraw by doxygen