Python Quickstart


Mirrorcle’s Python API is wrapped from C++ to Python using the Simplified Wrapper and Interface Generator (SWIG).

This means that all classes, structs, and methods that are available in Mirrorcle’s C++ library are also available in Python!

The key difference is that the Python API uses NumPy for handling arrays instead of C-style arrays and pointers.


For Windows users:

Mirrorcle’s Python SDK for Windows requires a 32-bit build of Python.

Ensure that you have installed 32 bit Python 3 to your system and have added Python to your Environment Variables -> Path

This can be checked by running the below line in your Command Prompt

python -V -V

Which should return a Python version greater than 3.x.x, and a 32 bit target build system.

For Linux users:

Often Ubuntu systems will have both Python 2 and Python 3 installed. To differentiate use python3 to specify Python 3



Debug versions of Python require that the mtidevice/_MTIDevice.pyd file be copied and renamed to _MTIDevice_d.pyd, otherwise Python will not be able to find and load the _MTIDevice.pyd library.


Mirrorcle’s Python API requires only NumPy, which will be installed automatically upon python install

To run the examples, OpenCV-Python and freetype-py is required.

These will also be downloaded upon running the

Additionally, these packages can be installed using pip (Python package installer):


python -m pip install numpy
python -m pip install opencv-python
python -m pip install freetype-py


pip3 install numpy
pip3 install opencv-python
pip3 install freetype-py

The script is provided to quickly install these three Python modules via pip, and can be run from the command prompt/terminal:


Running the Provided Demos

Mirrorcle’s Python SDK comes as a folder labeled “Python SDK X.X.X.X”. Inside that directory is the SDK-Python folder. It is recommended to copy the SDK-Python folder to your C:MirrorcleTechfolder which was created after installing the Mirrorcle Software Suite. If a different directory was chosen during the Mirrorcle Software Suite installation process, it is recommended to copy the SDK-Python folder to that directory, instead.

Inside the SDK-Python folder, there are five demo files.
  • Python translation of the C++ MTIDevice-Demo, showcases multiple drive methodologies
  • For owners of the tracking bundle add-on or DEMO-01, demonstrates mutliple approaches tracking using MEMS mirrors
  • Demonstrates interaction with RGB Playzers for multi-color vector display
  • A unique Python demo that demonstrates the versatility of the Mirrorcle API when paired with the Python language
  • A template for users to write their own demos. The template handles connection, loading parameters, and disconnecting.

In order to run the demos, navigate to the SDK-Python folder using your shell (command prompt on Windows, terminal on Linux) or IDE of choice.

For Windows users:


For Linux users:


Installing the mtidevice Module

For Windows users, the folder contains a file to allow for installation of the mtidevice module to your Python site-packages.

To install to your Python installation’s site-packages, run the following:

python install

For Linux users and as an alternative for Windows users, the Mirrorcle Python package “mtidevice” can be integrated in your project by placing the “mtidevice” folder in your project’s folder (i.e. in the same folder as your

Then see the “Importing the Module” section below.

Importing the Module

Independent of the chosen installation method.

import mtidevice
from mtidevice import MTIError, MTIAxes, MTIParam, MTIDataMode, MTISync, MTIDataFormat