File tree 1 file changed +4
-2
lines changed
PythonForDelphi/Demos/FPC/Demo06
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -173,9 +173,10 @@ function PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
173
173
else
174
174
begin
175
175
// Else check for a method
176
- Result := Py_FindMethod( MethodsByName(' PythonType1' ), obj, key);
176
+ Result:=PyObject_GenericGetAttr(obj,PyString_FromString(' OffsetBy' ));
177
+ // Result := Py_FindMethod( MethodsByName('PythonType1'), obj, key);
177
178
// or we could write, because it's quicker:
178
- // Result := Py_FindMethod( Form1.PythonType1.MethodsData, obj, key);
179
+ // Result := Py_FindMethod( Form1.PythonType1.MethodsData, obj, key);
179
180
if not Assigned(Result) then
180
181
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format(' Unknown attribute "%s"' ,[key])));
181
182
end ;
@@ -261,6 +262,7 @@ procedure TForm1.PythonType1Initialization(Sender: TObject);
261
262
TheType := PyType;
262
263
// And then add the methods of the object, if needed
263
264
AddMethod( ' OffsetBy' , PyPoint_OffsetBy , ' OffsetBy(dx, dy)' );
265
+ PythonEngine1.PyType_Ready(TheTypePtr);
264
266
end ;
265
267
end ;
266
268
You can’t perform that action at this time.
0 commit comments