Using Python4Delphi, itβs quite simple to suggest Delphi methods for Python so that Python can invoke the Delphi application. However, I was not able to return the Python list created by the Delphi method for Python. For instance:
function TDelphiAPI.callMethod : PPyObject; begin // Create a new empty list of three elements result := GetPythonEngine.PyList_New(3); end; import mylib p = mylib.DelphiAPI() print p.callmethod()
This returns "NoneType" when called from Python. If PPyObject is changed to a type such as integer, AnsiString or double, Python selects the correct type and displays it correctly. I use
GetPythonEngine.AddMethod ('callMethod', @TDelphiAPI.callMethod, 'callMmethod)');
to infer a method from Delphi. As far as I can tell, there is no way to specify types for arguments or return type.
I am wondering if any of the python delphi types returned like lists or even numpy arrays?
rhody source share