Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-12-28 18:37:13


Hi John,

What you want to do is certainly possible. If you know how to verify that a
given Python object holds a wrapped wxDateTime, and extract a reference to
that wxDateTime object, then you have everything you need. You just need to
declare and define the appropriate from_python(PyObject, type<...>)
functions to do the extraction. In this case, ... will be selected from
among wxDateTime, wxDateTime&, wxDateTime const&, wxDateTime*, etc.,
depending on which argument types you need to support for wrapped functions.

In libs/python/example/do_it_yourself_convts.cpp you will find a nice
example of how it can be done. This example converts a Python tuple to a
user-defined type. You will want to substitute examinations of the object
expected to hold a wxDateTime for the calls manipulating the tuple. Note
that some of the boost::python::tuple wrapping code throws exceptions, e.g.
the constructor will throw if the Python object is not in fact a tuple. You
should mimick this behavior for your wxDateTime object.

-Dave

----- Original Message -----
From: "John Hunter" <jdhunter_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, December 28, 2001 11:20 AM
Subject: [boost] Boost::Python and Swig

>
> I have a class which I am exposing to python via Boost::Python which
> takes a wxDateTime object (from the wx lib) as an argument in the
> constructor.
>
> The wxDateTime class has already been exposed to python with SWIG.
>
> My question is: is there any way to pass wxDateTime objects created in
> python from the wxPython (ie SWIG generated) library to my boost
> python class, or do I need to wrap the wxDateTime library with
> boost::python is order to pass it to my boost python extensions?
>
> I suspect the latter, but I thought I might try.
>
>
> Thanks,
> John Hunter
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk