boost::python bindings

I’m allergic to swig, so yesterday I created some boost::python bindings. Compiles under windows (though the code is very portable), and the 3 example apps I’ve ported so far all work fine.

Nice thing about boost python bindings is that it’s all c++ – you don’t have an extra tool in your chain (as is the case with swig, sip, etc.).

I’ve adhered to the OF classes as they are, but I’ve thrown in some extra attributes here and there with an eye to making things more pythonic – e.g., adding a python property to a class in addition to the C++ get/set methods.

It’s a complete binding of OF, with the exception of the audioReceived and audioRequested methods, which are problematic to wrap.

It’s a single cpp file. No time for a proper release right now, but if anyone wants the code or a win32 binary, they are welcome to contact me (kevin.atkinson@gmail.com).

Cheers,

Kevin

woops, I meant to add the above post to the existing python bindings thread! Sorry for the clutter…

Kevin

great!!

it would be awesome to try it out - the previous python binding had some real issues (no one was able to get it to run) and I think it would be nice to see another branch that’s working.

could you consider adding it here? :
addons.openframeworks.cc, it’s a repository we just started to collect addons / user contributions, etc and it allows you to upload files, create a wiki, take issues, etc… it’s also good for posting unfinished stuff too, since others can join the project as developers / managers / etc.

you can fill out a form linked off the front page and we’ll set it up for you…

thanks!
zach

Hey sure, Zach, be happy to. Don’t have much time to commit to it, but I’m happy to share what I have.

cheers,

Kevin

For those who might be interested, here are the boost.python windows bindings.

http://almach.lunarpages.com/~metho9/OF-…-ndings.zip

Included is the one-file source, a VC9 project to build it, and a pre-built binary. There is a readme in the all_binaries folder describing build requirements, where to put this in your OF distribution, stuff like that.

There are also 8, count’em 8, examples ported from the OF distribution. They all work great, except soundPlayerFFTExample.py which hangs when you quit, and I haven’t had a chance to see why.

The code is for windows, though with minor modifications it should compile on linux. Last I heard, no one had got boost.python working on Mac, so no luck there for now.

Enjoy! I’m eager to hear if any one is able to run this. Let me know how it goes…

Kevin Atkinson

thank you for this,most of the examples working great except graphicsExample.py and opencv one

maybe it’s just my machine’s problem,the graphicsExample should be change the last code as
of.ofSetupOpenGL(1024, 768,of.OF_WINDOW),however the orginal one is
of.'OF_WINDOW

and opencv should add “cv.” before IPL_DEPTH_8U otherwise it will give you
NameError:

i don’t know why, just those two examples got some errors.
again,thank you.

Hey thanks, liquid! You are the first person I’ve heard from about this, so I’m glad to hear that it works on someone else’s machine.

That’s definitely a typo in graphicsExample.py. And I forgot to mention that the opencv example is unfinished, so there are almost certainly other issues as well.

(Incidentally, I never specified a license on the bindings. I’ll add a note to the files, but the upshot is you can use them for whatever you want, but if you redistribute the source, just leave my name as the original author.)

Thanks so much for giving it a whirl!

Cheers,

Kevin Atkinson

thank you for the reply,i understand license issue ,don’t worry about it. if i using it i’ll leave your full name as original author.

thank you again for this great bindings

Great job! It works perfectly on my machine.