IronPython and Nodebox in C#
Question: **My plan:**

I'm trying to setup my C# project to communicate with Nodebox to call a
certain function which populates a graph and draws it in a new window.

**Current situation: [fixed... see Update2]**

I have already included all python-modules needed, but im still getting a

> `Library 'GL' not found`

it seems that the `pyglet` module needs a reference to `GL/gl.h`, but can't
find it due to IronPython behaviour.

**Requirement:**

The project needs to stay as small as possible without installing new
packages. Thats why i have copied all my modules into the project-folder and
would like to keep it that or a similar way.

**My question:**

Is there a certain workaround for my problem or a fix for the library-folder
missmatch. Have read some articles about `Tao-Opengl` and `OpenTK` but can't
find a good solution.

**_Update1:_**

Updated my sourcecode with a small pyglet window-rendering example. Problem is
in pyglet and referenced c-Objects. How do i include them in my c# project to
be called? No idea so far... experimenting alittle now. Keeping you updated.

**_SampleCode C#:_**

    
    
    ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(null);
    ScriptRuntime runtime = new ScriptRuntime(setup);
    ScriptEngine engine = Python.GetEngine(runtime);
    
    ScriptSource source = engine.CreateScriptSourceFromFile("test.py");
    ScriptScope scope = engine.CreateScope();
    source.Execute(scope);
    

**_SampleCode Python (test.py):_**

    
    
    from nodebox.graphics import *
    from nodebox.graphics.physics import Vector, Boid, Flock, Obstacle
    
    flock = Flock(50, x=-50, y=-50, width=700, height=400)
    flock.sight(80)
    
    def draw(canvas):
        canvas.clear()
        flock.update(separation=0.4, cohesion=0.6, alignment=0.1, teleport=True)
        for boid in flock:
            push()
            translate(boid.x, boid.y)
            scale(0.5 + boid.depth)
            rotate(boid.heading)
            arrow(0, 0, 15)
            pop()
    
    canvas.size = 600, 300
    
    def main(canvas):
        canvas.run(draw)
    

**_Update2:_**

Line 139 [pyglet/lib.py] sys.platform is not win32... there was the error.
Fixed it by just using the line:

    
    
    from pyglet.gl.lib_wgl import link_GL, link_GLU, link_WGL
    

Now the following Error:

    
    
    'module' object has no attribute '_getframe'
    

Kind of a pain to fix it. Updating with results...

**_Update3:_**

Fixed by adding following line right after first line in C#-Code:

    
    
    setup.Options["Frames"] = true;
    

Current Problem:

`No module named unicodedata`, but in `Python26/DLLs` is only a `*.pyd` file`.
So.. how do i implement it now?!

**_Update4:_**

Fixed by surfing: [link text](http://www.java2s.com/Open-
Source/Python/Windows/pyExcelerator/pywin32-214/isapi/test/build/bdist.win32/winexe/temp/unicodedata.py.htm
"Link") and adding `unicodedata.py` and `'.pyd` to C# Projectfolder.

Current Problem:

'libGL.so not found'... guys.. im almost giving up on nodebox for C#.. to be
continued

**_Update5:_**

i gave up :/ workaround: c# communicating with nodebox over xml and
filesystemwatchers. Not optimal, but case solved.


Answer: -X:Frames enables the frames option as runtime (it slows code down a little to have access to the Python frames all the time). 

To enable frames when hosting you just need to do:

    
    
    ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(new Dictionary<string, object>() {
        { "Frames", true }
    });
    

Instead of the null that you're passing now. That's just creating a new
dictionary for the options dictionary w/ the contents "Frames" set to true.
You can set other options in there as well and in general the -X:Name option
is the same here as it is for the command line.

