Replies: 1 comment
-
See https://github.com/pyscripter/python4delphi/blob/master/Tests/WrapDelphiTest.pas#L327 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I am (very) slowly making headway in getting my apps ready for Python scripting but I have a coup[le of questions that I am stuck on.
I have several objects in my app that manage indexed lists of other objects.
e.g
{$M+}
TpyInstruments = class
protected
public
function Get_Count: Integer;
function Get_Items(Item: Integer): TInstrument;
function Add(InstType: Integer): TInstrument;
procedure Delete(Index: Integer);
function Find(const Name: String): TInstrument;
procedure Clear;
property Count: Integer read Get_Count;
property Items[Item: Integer]: TInstrument read Get_Items; default;
end;
{$M-}
I wrapped this object and successfully managed to call the functions and access the count property.
The problem I have is not being able to access the Index properties from Python, it just gives an error "Error in getting property Items, Unknow attribute"
What is the correct use of properties that are indexed arrays from Python?
import Autolab as al
print(al.Instruments.Count)
a = al.Instruments.Items[0]
Beta Was this translation helpful? Give feedback.
All reactions