psla314 3 Posted December 7, 2020 Hi Is it possible to create an array of objects in Delphi and then have that available in the Python Script ? e.g. Where DataIn is pre defined in Delphi and added to the module using PythonModule.SetVar( 'DataIn', p ); x1 = DataIn[0].X y1 = DataIn[0].Y x2 = DataIn[1].X y2 = DataIn[1].Y I can get the following to work using 0 = X and 1 = Y and a DataInType : TPythonType x1 := DataIn(0,0); y1 := DataIn(0,1); x2 := DataIn(1,0); y2 := DataIn(1,1); p := DataInType.CreateInstance; Source := TPyDataList( PythonToDelphi(p) ); PythonModule.SetVar( 'Source', p ); PythonEngine.Py_DecRef(p); But am having trouble getting the array operator to work in Delphi4Python Is this even possible to use an array operator to call default index getters and setting like in Delphi ? Regards Peter Share this post Link to post
pyscripter 689 Posted December 7, 2020 There are many ways to expose Delphi objects to Python but by far the easiest is to use WrapDelphi. Please have a look at the WrapDelphi unit tests and Demo 31. 1 Share this post Link to post