[Python.NET] exposing modules

Haran Shivanan shivanan at statictype.org
Fri Jun 9 05:27:05 CEST 2006


Hi,

I'm trying to embed the python interpreter in my .NET-based program.
The basic stuff is working fine.
But now, I want to expose some of my program's internal data to the scripts.
(ie, not just functions that live in an assembly, but access to my live 
program's state)
For example, if I have a WinForms application, I want to be able to 
access a textbox's current text from python.
Ideally, I should be able to do something like this from a script:
import MyApp
s = MyApp.GetText()

Is there any way to do this in Python.NET?
And if not, can someone provide me with some pointers on how to go about 
adding the functionality to the Python.NET code?
(I believe we have to use issue a call to Py_InitModule or something, 
right?)

Thanks,
Haran


More information about the PythonDotNet mailing list