1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

QT interface specifics?

Posted by Jurgis Pralgauskis on Mar 05, 2009

hello I am trying http://dev.nodebox.net/wiki/Qt
on ubuntu 8.10

most examples work, but some don't

for example:
----
supershape = ximport("supershape")
File "/home/tmp/nodebox-qt/nodebox/graphics/__init__.py", line 58, in ximport
lib = __import__(libName)
ImportError: No module named supershape
--
I suspect I need library here
sys.path.append('pathto/nodebox/libs')
in nodebox-qt/nodebox/graphics/__init__.py
and it works...

if I try sudo python setup.py install
running install
running build
running build_ext
building 'cSuperformula' extension
creating build
creating build/temp.linux-i686-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.5 -c superformula.c -o build/temp.linux-i686-2.5/superformula.o -DMACOSX -DAPPLE_RUNTIME -no-cpp-precomp -Wno-long-double -g -Wall -Wstrict-prototypes -Wmissing-prototypes -Wformat=2 -W -Wshadow -Wpointer-arith -Wmissing-declarations -Wnested-externs -Wno-long-long -Wno-import -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
gcc: i386: No such file or directory
gcc: ppc: No such file or directory
gcc: unrecognized option '-no-cpp-precomp'
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-arch"
cc1: error: unrecognized command line option "-Wno-long-double"
error: command 'gcc' failed with exit status 1
----

Possibly other things:

also in Feedback.py
----
"/home/tmp/nodebox/examples/Advanced/Feedback.py", line 23, in
image(None, random(-50,49), random(-50,49), image=canvas._nsImage)
AttributeError: 'Canvas' object has no attribute '_nsImage'
----

also can't export PDF


 
Posted by Stefan on Mar 05, 2009

First you might want to update your nodebox install since i added a few fixes that address some of the problems you're having. Just run svn update in the folder you downloaded nodebox to.

Second it's best you put the extra libraries you want in the nodebox folder located in your home directory. The first time you ran the program it created this folder for you. If supershape is located there, nodebox should be able to locate said library without you needing to modify the python path.

Then about compiling the superformula source. The setup.py includes quite a few mac-specific optimization flags. If you're on linux, you can leave those out (ie remove the CFLAGS and BASE_LDFLAGS stuff) and replace

cSuperformula = Extension("cSuperformula", sources = ["superformula.c"], extra_compile_args=CFLAGS, extra_link_args=BASE_LDFLAGS)

with

cSuperformula = Extension("cSuperformula", sources = ["superformula.c"])

After this you can safely build it with python setup.py install.

I also added a _qImage attribute to the Canvas class, so you can replace image=canvas._nsImage in feedback.py with image=canvas._qImage.

I also fixed PDF export, but if you're using Qt 4.3 (which I suspect you are, since Ubuntu 8.10 comes with that version) you can't set it to an arbitrary size. So it will export to pdf right now but if you want the control the output size you need at least Qt 4.4.