Embedding Python: Creating Python Class from Application

Kakacek krivanek.jirka at seznam.cz
Thu Jan 12 10:08:17 EST 2006


Hello All,

Let's say I have a following python code:

class hw_class:
   def __init__(self):
       pass
   def hello_world(self):
       print 'Hello World!'
create_instance('hw_class', 'hw')
hw.hello_world()
hw = None

The 'create_instance' function should be implemented in the application
(powered by Delphi - P4D) which is embedding the Python.dll.

I am trying to do this for some time having no success. I am missing
these informations:
1. How to register global python variable from application which is
embedding python?
2. How to assign this variable with the class instance.
3. How to create the instance of class which is unknown at the compile
time.

Could someone supply the (C/Pascal) code fragment for this?

Thanx,

Jiri.




More information about the Python-list mailing list