[PyKDE] Using SIP to call Python from C++
Niac Neb
niacneb at yahoo.com
Thu May 19 22:53:38 BST 2005
Jim,
You are helping me greatly!!!
I know how to **call** a C++ object from Python ...
just not how to **pass** the object from C++ to
Python.
So, how would I pass the following C++ object,
cPlotData, to Python?
struct sVec2
{
int x;
int y;
};
class cPlotData
{
public:
int GetSize() { return mData.size(); }
sVec2 Get(int i) { return mData.at(i); }
protected:
std::deque< sVec2 > mData;
};
How should I pass an instance of this using Python/C
API?
I'm assuming you are referring to using these:
PyObject_CallObject
PyDict_GetItemString
PyTuple_SetItem
Or, is there an easier way?
--- Jim Bublitz <jbublitz at nwinternet.com> wrote:
> On Thursday 19 May 2005 12:49, Niac Neb wrote:
>
> Passing the plot data would depend on how much data
> there is - if it's a
> really large amount, passing it via a file or pipe
> would seem to make sense.
> Otherwise, it can be loaded into a Python structure
> (list, dict) using the
> Python C API and passed as an arg to the function
> call.
>
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html
More information about the PyQt
mailing list