sharing time between embedded python and c code

howard at howard at
Sat Oct 13 06:08:20 CEST 2001

I would like to embed python into a (windows) c-program and spend some
time in the python interpreter (processing some simple gui updates)
and some time in my c program (handling some DirectX calls and such).

I seem to be stuck on how to do this.  I have embedded the Python
interpreter, can import and run a program, and return (having a
.mainloop in the python code to pump things).  

However, what I would LIKE to do is 
   1.  Load the python code at initialization time.
   Loop (at really long time)
   	a. Periodically call something in the Python code to 
		perform ".updates" .
	b. Periodically call the verklempt Windows/DirectX
		routines for the high speed part of things.

I expect to run several threads:
     One for my dedicated DirectX updates
     One for the Python calls.

I must be missing something since I can't figure out how to call a
specific function in the interpreter environment without receiving an

Any ideas?


Howard Lightstone
howard at

More information about the Python-list mailing list