Combining C and Python programs

S

Sortie

I want to write a program that will use ode for the physics
simulation, whose python bindings are outdated. So I'm writing
the physics engine in C and want to write the drawing code in
Python. What will be the best way of making those two programs
work together? THe physics engine won't have to run concurrently
with the drawing code. It will only return some position data so
they can be drawn.
 
H

Hendrik van Rooyen

I want to write a program that will use ode for the physics
simulation, whose python bindings are outdated. So I'm writing
the physics engine in C and want to write the drawing code in
Python. What will be the best way of making those two programs
work together? THe physics engine won't have to run concurrently
with the drawing code. It will only return some position data so
they can be drawn.

Have you looked at ctypes?

- Hendrik
 
D

Diez B. Roggisch

Sortie said:
I want to write a program that will use ode for the physics
simulation, whose python bindings are outdated. So I'm writing
the physics engine in C and want to write the drawing code in
Python. What will be the best way of making those two programs
work together? THe physics engine won't have to run concurrently
with the drawing code. It will only return some position data so
they can be drawn.

How about you update the ODE-bindings? They shouldn't be hard to enhance
to cover the latest features.

Diez
 
P

Philip Semanchuk

I want to write a program that will use ode for the physics
simulation, whose python bindings are outdated. So I'm writing
the physics engine in C and want to write the drawing code in
Python. What will be the best way of making those two programs
work together? THe physics engine won't have to run concurrently
with the drawing code. It will only return some position data so
they can be drawn.


I'd look at ctypes first, as Hendrik suggested. It's pretty simple and
part of the standard library.

If that doesn't work for you for some reason and you're willing to use
something outside of the standard library, you might find Cython useful.


Good luck
Philip
 
C

Cousin Stanley

I want to write a program that will use ode for the physics
simulation, whose python bindings are outdated. So I'm writing
the physics engine in C and want to write the drawing code in
Python. What will be the best way of making those two programs
work together? THe physics engine won't have to run concurrently
with the drawing code. It will only return some position data so
they can be drawn.

You might find VPython useful ....

http://www.vpython.org/

A VPython example using ode ....

http://vpython.wikidot.com/forum/t-109218
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top