I'm attempting to embed some matplotlib
figures inside of an ActiveX component using Active Qt on Windows 7, having already successfully embedded matplotlib
figures inside of a regular Qt project.
Using the Simple and Menus examples from the Qt docs as a reference, I have managed to embed a Python interpreter in an ActiveX component and run some basic Python code that constructs QWidget
objects using PyQt5
.
This all works fine and I am able to use PyQt to construct parts of the interface of the ActiveX component, and send signals between widgets created with either Python and c++ etc. with no problems. I can even create matplotlib FigureCanvas
objects using the PyQt5
backend. However, as soon as I try to embed a FigureCanvas
that has had a subplot added to it, my ActiveX component crashes with a generic Visual C++ Runtime Error:
The application has requested the Runtime to terminate it in an unsual way. Please contact the application's support team for more information.
To make matters worse, I am unable to run a debug build because the debug build of libpython
requires debug builds of all compiled extension module dependencies to be built, and I haven't had any luck with building numpy
/scipy
from scratch.
Does anyone have any ideas about what could be causing this crash? I wonder whether it has something to do with the threading model used by COM objects or the Python GIL but I don't know enough about the subjects. Any suggestions welcome.