006 python bindings with installer. win32

I have been away for a while, but I need to use OF again, so I thought I would update. This time I made it a proper package. I’ll try to maintain this one up to date. The installation is much simpler, just a couple of clicks. I don’t have access to any other OS so I can’t make builds for those systems, only windows. :?

current version: ofpython-006.1

requirements:
python 2.6 (latest release as of today is 2.6.4):
http://www.python.org/ftp/python/2.6.4/python-2.6.4.msi

installation:
You can install using the provided installer or through setup.py.

win32 installer:
http://openframeworks-python-bindings.g-…-.win32.exe

Just download, install. Pretty straight forward install. After installation, you can download and run the example below.

setup.py installer:
http://openframeworks-python-bindings.g-…–006.1.zip

open a command prompt and navigate to “ofpython-006.1”
run “python setup.py install”
it should install the package into your system. you can now access the package.

source:
http://openframeworks-python-bindings.g-…-.1-src.zip

running the example:
http://openframeworks-python-bindings.g-…-xample.zip

extract the file somewhere
open a command prompt and navigate to the folder that contains the file
run “python animation.py”

Everything should run fine.

You can report any bugs here:
http://code.google.com/p/openframeworks-…-ssues/list

GREAT!! it does work and it is really easy to install.

it would be great to have the addons included though.

I am going to try to create a linux version, there is already an OSX version so thats the only one missing… I already tried this few months ago but I could not get it to work, but since you have used CodeBlocks to produce this version maybe it will be easier this time.

thanks!

is there an error with mouseReleased event? The C++ API is

  
void testApp::mouseReleased(int x, int y, int button)  

so in Python it should be :

  
mouseReleased(self, x, y, button)  

however i am getting an error with the number of arguments. I tried with

  
def mouseReleased(self, *args): print "mouse released", args  

and I see that the event is actually called twice for every mouse released action. First time i is called with four args (self, x, y, button), second with one arg only (self)

this time i clicked twice for example…

C:\Documents and Settings\admin>C:\Python26\python.exe “C:\Documents and Settin
gs\admin\Desktop\c++\pyOpenFrameworks\ofpython-006.1\examples\animation.py”
mouse released (218, 210, 0)
mouse released ()
mouse released (218, 210, 0)
mouse released ()

i am giving a try at creating a linux version of this python bindings. However i have never done anything like this before. So to try to understand the process better I tried to create it from source in windows first. There I managed to run swig and compile the codeblocks project against the very latest version of OF after adjusting few paths. Some of them did not have the right path or where missing.

After this I moved to linux, I am trying in Ubuntu karmic. I guess I would have to change the openframeworks.i file first I have changed

  
#define __WIN32__  
#define OF_VIDEO_CAPTURE_DIRECTSHOW  
#define OF_VIDEO_PLAYER_QUICKTIME  
  

for

  
#define __LINUX__  
#define OF_VIDEO_CAPTURE_V4L  
#define OF_VIDEO_PLAYER_GSTREAMER  

but I am not sure if this is actually right

I have also been adding and correcting paths to libraries and includes trying to solve compilation error I was getting. However I am stuck here.

any help will be welcome. thanks.

||=== openframeworks, release ===|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_glSamplePass(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|25086|error: ‘glSamplePass’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_r_set(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29693|error: ‘pix24’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29693|error: ‘arg1’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29693|error: expected primary-expression before ‘)’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29693|error: expected ‘;’ before numeric constant|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29708|error: expected type-specifier before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29708|error: expected ‘>’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29708|error: expected ‘(’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29708|error: expected primary-expression before ‘>’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29708|error: expected ‘)’ before ‘;’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_r_get(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29730|error: ‘pix24’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29730|error: ‘arg1’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29730|error: expected primary-expression before ‘)’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29730|error: expected ‘;’ before numeric constant|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29742|error: expected type-specifier before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29742|error: expected ‘>’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29742|error: expected ‘(’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29742|error: expected primary-expression before ‘>’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29742|error: expected ‘)’ before ‘;’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_g_set(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29759|error: ‘pix24’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29759|error: ‘arg1’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29759|error: expected primary-expression before ‘)’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29759|error: expected ‘;’ before numeric constant|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29774|error: expected type-specifier before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29774|error: expected ‘>’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29774|error: expected ‘(’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29774|error: expected primary-expression before ‘>’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29774|error: expected ‘)’ before ‘;’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_g_get(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29796|error: ‘pix24’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29796|error: ‘arg1’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29796|error: expected primary-expression before ‘)’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29796|error: expected ‘;’ before numeric constant|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29808|error: expected type-specifier before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29808|error: expected ‘>’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29808|error: expected ‘(’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29808|error: expected primary-expression before ‘>’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29808|error: expected ‘)’ before ‘;’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_b_set(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29825|error: ‘pix24’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29825|error: ‘arg1’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29825|error: expected primary-expression before ‘)’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29825|error: expected ‘;’ before numeric constant|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29840|error: expected type-specifier before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29840|error: expected ‘>’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29840|error: expected ‘(’ before ‘pix24’|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29840|error: expected primary-expression before ‘>’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29840|error: expected ‘)’ before ‘;’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_b_get(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29862|error: ‘pix24’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29862|error: ‘arg1’ was not declared in this scope|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29862|error: expected primary-expression before ‘)’ token|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/pyOpenFrameworks/src/openframeworks_wrap.cxx|29862|error: expected ‘;’ before numeric constant|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options…|
||=== Build finished: 50 errors, 0 warnings ===|

more on the windows version. I have been updating the project by ech0 to the latest OF library details and paths.

I had to remove StandardFirmata.cpp and .h references from the CodeBlocks project because they are no longer included in OF and this was causing an error. After this I got this error

obj\release\src\openframeworks_wrap.o:openframeworks_wrap.cxx:(.text+0x700dc)||undefined reference to `ofVideoPlayer::qtGetFrameCount(MovieRecord*&)’|

commenting out manually this line in openframeworks_wrap.cxx solves it

{ (char *)“ofVideoPlayer_qtGetFrameCount”, _wrap_ofVideoPlayer_qtGetFrameCount, METH_VARARGS, NULL},

I can see that it is in the ofVideoPlayer.h file but I am not sure when this function is used. Apart from that the produced python library seems to work fine, at least in my basic tests.

I attach the zip with the CodeBlocks project for windows in case anyone is interested. It would be good to produce versions for all systems, I have a computers with XP and Ubuntu plus access to a laptop with OSX. So I could compile for linux and mac, with some help :slight_smile:

The linux version is still refusing to compile, I guess there are so many thing I am missing to tweak and adjust.

ofPython_2.6_0061.zip

[quote author=“altern”]more on the windows version. I have been updating the project by ech0 to the latest OF library details and paths.

I had to remove StandardFirmata.cpp and .h references from the CodeBlocks project because they are no longer included in OF and this was causing an error. After this I got this error

obj\release\src\openframeworks_wrap.o:openframeworks_wrap.cxx:(.text+0x700dc)||undefined reference to `ofVideoPlayer::qtGetFrameCount(MovieRecord*&)’|

commenting out manually this line in openframeworks_wrap.cxx solves it

{ (char *)“ofVideoPlayer_qtGetFrameCount”, _wrap_ofVideoPlayer_qtGetFrameCount, METH_VARARGS, NULL},

I can see that it is in the ofVideoPlayer.h file but I am not sure when this function is used. Apart from that the produced python library seems to work fine, at least in my basic tests.

I attach the zip with the CodeBlocks project for windows in case anyone is interested. It would be good to produce versions for all systems, I have a computers with XP and Ubuntu plus access to a laptop with OSX. So I could compile for linux and mac, with some help :slight_smile:

The linux version is still refusing to compile, I guess there are so many thing I am missing to tweak and adjust.[/quote]

If you want to compile it for linux I think your going to need to replace the gl.h file with the linux version of that file. I think there may be some variations in the definition of some of the functions between windows and linux and that may be what is causing the compiling error.

I haven’t included any of the addons because I wasn’t sure which ones people would wanted included. Included all or just some? Which ones are most popular? I’ll release a newer version with the included addons and 0061 support.

mousereleased being called twice might be due to method overloading in the library. if you start a c++ project and you make a mousereleased function in testapp with no arguments (and you define it in the h file) you will see that both definitions get called on mousereleased. i’ll look into it more.

By the way, I was thinking of porting this library for the python version:

http://hype.joshuadavis.com/

Seems kind of interesting and I guess it fits with the whole visual library & scripting thing. What do you guys think?

Good luck and if you need more help compiling the Linux version let me know.

good. now the gl error are not there anymore. I removed glu.h from the source folder, edited the openframeworks.i file to add the path to /usr/include/GL and run again the swig script. I already was pointing to the right path in the codeblocks project.

However I still get errors, this time I dont really know where they come from.

/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/ofPython_2.6_0061/src/openframeworks_wrap.cxx||In function ‘PyObject* _wrap_pix24_r_set(PyObject*, PyObject*)’:|
/home/r2d2/Desktop/c++/of_preRelease_v0061_linux_FAT/apps/myApps/ofPython_2.6_0061/src/openframeworks_wrap.cxx|31257|error: ‘pix24’ was not declared in this scope|

… and so on …

Basically I get the same errors as in the errors i posted above but without the first two which where the gl related ones.

I dont really know where this pix24 is comming from, so i am not sure what i am missing this time…

I paste here the swig script i am using and its output in casw it rings some bell. But I guess there might be loads of things from the Codeblocks project that should be changed in order to compile under linux.

thanks!

% swig -Wall -python -threads -c++ -I…/…/…/…/libs/openFrameworks -I…/…/…/…/libs/openFrameworks/graphics -I…/…/…/…/libs/openFrameworks/app -I…/…/…/…/libs/openFrameworks/sound -I…/…/…/…/libs/openFrameworks/utils -I…/…/…/…/libs/openFrameworks/communication -I…/…/…/…/libs/openFrameworks/video -I…/…/…/…/libs/openFrameworks/events -I…/…/…/…/libs/rtAudio/include -I…/…/…/…/libs/freetype/include -I…/…/…/…/libs/freetype/include/freetype2 -I…/…/…/…/libs/FreeImage/include -I…/…/…/…/libs/fmodex/inc -I…/…/…/…/libs/glee/include -I…/…/…/…/libs/poco/CppInput -I…/…/…/…/libs/poco/Poco -I…/…/…/…/libs/unicap/include -I…/…/…/…/libs/gstappsink/include -I/usr/include/GL openframeworks.i
/usr/include/GL/gl.h:116: Warning(305): Bad constant value (ignored).
/usr/include/GL/gl.h:120: Warning(305): Bad constant value (ignored).
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:55: Warning(362): operator= ignored
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:62: Warning(362): operator= ignored
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:173: Warning(312): Nested union not currently supported (ignored).
…/…/…/…/libs/openFrameworks/utils/ofUtils.h:12: Warning(322): Redundant redeclaration of ‘ofNextPow2’,
…/…/…/…/libs/openFrameworks/utils/ofMath.h:19: Warning(322): previous declaration of ‘ofNextPow2’.
…/…/…/…/libs/openFrameworks/graphics/ofTexture.h:46: Warning(362): operator= ignored
…/…/…/…/libs/openFrameworks/graphics/ofImage.h:46: Warning(362): operator= ignored
…/…/…/…/libs/openFrameworks/app/ofAppRunner.h:17: Warning(322): Redundant redeclaration of ‘ofGetFrameNum’,
…/…/…/…/libs/openFrameworks/utils/ofUtils.h:17: Warning(322): previous declaration of ‘ofGetFrameNum’.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:301: Warning(403): Class ‘ofBaseImage’ might be abstract, no constructors generated,
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:255: Warning(403): Method ofBaseDraws::draw(float,float) might not be implemented.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:285: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:295: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:285: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:295: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:285: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/utils/ofTypes.h:312: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/graphics/ofImage.h:55: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/graphics/ofImage.h:62: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/video/ofVideoPlayer.h:55: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/video/ofVideoPlayer.h:42: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/video/ofVideoGrabber.h:44: Warning(473): Returning a pointer or reference in a director method is not recommended.
…/…/…/…/libs/openFrameworks/video/ofVideoGrabber.h:43: Warning(473): Returning a pointer or reference in a director method is not recommended

regarding the addons I would include all the ones in the FAT version, if this is not a big problem to compile. there could be two versions like in OpenFrameworks, the standard and the FAT.

I’m look over the functionality of some of them and I think there is alot of overlap between some addons and the python libraries. Some of them are even easier to do in python, so they are aren’t really necessary (the ones about networking, directories, and threading specifically). I guess I could do one with the essentials and one with all the libraries. I think the latter would be useful only if you plan to port your code to C++. I’d like to hear what you guys think.

[quote author=“altern”]good. now the gl error are not there anymore. I removed glu.h from the source folder, edited the openframeworks.i file to add the path to /usr/include/GL and run again the swig script. I already was pointing to the right path in the codeblocks project.

However I still get errors, this time I dont really know where they come from…[/quote]

I’m installing ubuntu on my vmware. I’ll try to get a linux version up soon.

about the addons: you are right, i did not think about the conflict with the python libraries before… difficult question. I have only used so far OSC, OpenCV and XML addons so I am not the best person to answer. I guess the OSC and XML are not necesary but the OpenCV maybe would.

about the linux version : i have been trying to find where my compilation errors come from, Zach told me that pix24 struct is defined in libs/openframeworks/video/ofQtUtils.h however this does not make much sense because there is already a path to that folder in the project. So back to square one.

I have a workshop next week, it is very short one, more like a crash course and it would be so nice to be able to use OpenFrameworks there!. It is for art students so I need to use Python but I believe using pyOF would be very good since once they understand this they can switch to C++ more easily that it they have been using pyopengl, pygame or pyglet. Also the OF comunity is closer to their interest and more “artist-friendly” I would say.

i would be happy to (try to) port the examples to Python, I have already done couple of them in windows, I would be also testing the bindings and maybe write some docs if needed. But students will be using Linux in the workshop so I would need to have this before. Otherwise I would go for pyglet or pygame.

i have been working in porting the OF examples to python. I attach the files to this post. To run the examples you need to uncompress thezip and create a folder called data next to the files, copy there all the content you find in the data folder of each of the OF C++ examples. I cannot upload the zip with all the assets as it is too big.

There are some errors, I paste here the output of the errors, some of them might be due to me not knowing how to port some parts of the code to Python (TypeError: ‘SwigPyObject’ object is unsubscriptable ??) but others I believe there are bugs.

There is one thing I dont know how to deal with. In C++ when cheking for keybord keys for example

  
void testApp::keyPressed(int key)  
{   
	if(key == 'f') printf("f pressed");  
}  

currently I have ported it as

  
  
    def keyPressed (self, key) :  
        if key == 102 : # f  
           print "f pressed"  
  

is there a way to use something equivalent to ‘f’ in python?

This is the state of the different examples

Untested :
serialExample
firmataExample

Working fine:
advancedGraphicsExample
emptyExample
eventsExample
fontExample
graphicsExample
imageSaverExample
moviePlayerExample
windowExample
textureScreengrabExample
textureExample

*Not working* :
audioInputExample
audioOutputExample
soundPlayerExample
advancedEventsExample
imageLoaderExample
polygonExample
fontShapesExample
movieGrabberExample
soundPlayerFFTExample

This is the output of errors

*soundPlayerFFTExample.py

C:\Documents and Settings\admin\Desktop\c++\of_preRelease_v0061_win_cb_FAT\ap
MyApps\ofPython_2.6_0061\examples>c:\python26\python.exe soundPlayerFFTExampl
y
Traceback (most recent call last):
File “soundPlayerFFTExample.py”, line 92, in update
if self.fftSmoothed[i] < val[i] :
TypeError: ‘SwigPyObject’ object is unsubscriptable

* movieGrabberExample.py

***** VIDEOINPUT LIBRARY - 0.1995 - TFW07 *****

SETUP: Setting up device 0
SETUP: Logitech QuickCam Communicate STX
SETUP: Couldn’t find preview pin using SmartTee
SETUP: Default Format is set to 320 by 240
SETUP: trying format RGB24 @ 320 by 240
SETUP: Capture callback set
SETUP: Device is setup and ready to capture.

Traceback (most recent call last):
File “movieGrabberExample.py”, line 34, in update
self.videoInverted[i] = 255 - pixels[i];
TypeError: ‘SwigPyObject’ object is unsubscriptable

* advancedEventsExample.py

python.exe advancedEventsExample.p
y
Traceback (most recent call last):
File “advancedEventsExample.py”, line 29, in setup
self.evObject = eventsObject()
File “advancedEventsExample.py”, line 9, in __init__
newFloatEvent = ofEvent()
NameError: global name ‘ofEvent’ is not defined

* imageLoaderExample.py

python.exe imageLoaderExample.py
Traceback (most recent call last):
File “imageLoaderExample.py”, line 54, in draw
value = pixels[j * w + i]
TypeError: ‘SwigPyObject’ object is unsubscriptable

* polygonexample.py

python.exe polygonExample.py
polygonExample.py:119: DeprecationWarning: integer argument expected, got float
for i in xrange(nStarPts) :
Traceback (most recent call last):
File “polygonExample.py”, line 173, in draw
ofEndShape(OF_CLOSE)
NameError: global name ‘OF_CLOSE’ is not defined

* audioInputExample.py audioOutputExample.py

python.exe audioInputExample.py
Traceback (most recent call last):
File “audioInputExample.py”, line 57, in audioReceived
self.left[i] = inp[i\*2]
TypeError: ‘SwigPyObject’ object is unsubscriptable

* soundPlayerExample.py

python.exe soundPlayerExample.py
Traceback (most recent call last):
File “soundPlayerExample.py”, line 27, in update
ofSoundUpdate();
NameError: global name ‘ofSoundUpdate’ is not defined

  • quiting the example with ESC freezes the program

* fontShapesExamples.py

python.exe fontShapesExample.py
Traceback (most recent call last):
File “fontShapesExample.py”, line 52, in draw
testChar = self.testFont.getCharacterAsPoints(self.letter)
File “c:\python26\lib\site-packages\openframeworks\__init__.py”, line 2790, in
getCharacterAsPoints
def getCharacterAsPoints(self, *args): return _openframeworks.ofTrueTypeFont
_getCharacterAsPoints(self, *args)
TypeError: in method ‘ofTrueTypeFont_getCharacterAsPoints’, argument 2 of type ‘int’

examples.zip