[vtkusers] c api and python and vtk

rharder at uiuc.edu rharder at uiuc.edu
Tue Jan 27 22:45:22 EST 2004


Hi, thanks for your help, but I still am not sure what I
am doing.

>In your C++ code, make a python string from your data array using
>the PyString_FromStringAndSize() API.

This is the definition from the api.
PyObject* PyString_FromStringAndSize(const char *v, int len)

I don't understand how I am supposed to pass the data 
component of my structure to this function.  My data component
is of type double.  How do I turn it into a c string to then
turn it into a PyString?

>>> import _sp4 as sp4
>>> p=sp4.new_Sp4Array()
>>> sp4.Sp4ArrayLoad(p,"poly.sp4")
0
>>> print sp4.Sp4Array_data_get(p)
_08204440_p_double


Not to mention that I want to then turn this 1D array into
an image that is say 256x256.  

I wish there were a good book,
Ross



More information about the vtkusers mailing list