Skip to content

Commit 8a24d23

Browse files
committed
Read Python imshow function
1 parent ca44282 commit 8a24d23

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

matplotlibcpp.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ struct _interpreter {
6969
PyObject *s_python_empty_tuple;
7070
PyObject *s_python_function_stem;
7171
PyObject *s_python_function_xkcd;
72+
PyObject *s_python_function_imshow;
7273

7374
/* For now, _interpreter is implemented as a singleton since its currently not possible to have
7475
multiple independent embedded python interpreters without patching the python source code
@@ -169,6 +170,7 @@ struct _interpreter {
169170
s_python_function_tight_layout = PyObject_GetAttrString(pymod, "tight_layout");
170171
s_python_function_stem = PyObject_GetAttrString(pymod, "stem");
171172
s_python_function_xkcd = PyObject_GetAttrString(pymod, "xkcd");
173+
s_python_function_imshow = PyObject_GetAttrString(pymod, "imshow");
172174

173175
if( s_python_function_show == nullptr
174176
|| s_python_function_close == nullptr
@@ -198,6 +200,7 @@ struct _interpreter {
198200
|| s_python_function_tight_layout == nullptr
199201
|| s_python_function_stem == nullptr
200202
|| s_python_function_xkcd == nullptr
203+
|| s_python_function_imshow == nullptr
201204
) { throw std::runtime_error("Couldn't find required function!"); }
202205

203206
if ( PyFunction_Check(s_python_function_show) == 0
@@ -227,6 +230,7 @@ struct _interpreter {
227230
|| PyFunction_Check(s_python_function_errorbar) == 0
228231
|| PyFunction_Check(s_python_function_stem) == 0
229232
|| PyFunction_Check(s_python_function_xkcd) == 0
233+
|| PyFunction_Check(s_python_function_imshow) == 0
230234
) { throw std::runtime_error("Python object is unexpectedly not a PyFunction."); }
231235

232236
s_python_empty_tuple = PyTuple_New(0);

0 commit comments

Comments
 (0)