Home/ Reference/ Find & Traverse

for i in range(1, coll.Count+1): s = coll.Item(i)

Manual iteration. Remember that CDR collections start at 1, so Python's range needs +1.

Signature

for i in range(1, coll.Count+1): s = coll.Item(i)

Notes

Manual iteration. Remember that CDR collections start at 1, so Python's range needs +1.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
page = doc.ActivePage
shapes = page.Shapes

# manual walk: CorelDRAW is 1-based, so range needs +1
for i in range(1, shapes.Count + 1):
    s = shapes.Item(i)                # s : the i-th shape
    print(i, "type", s.Type, "W", round(s.SizeWidth, 2))

About this section: Find & Traverse

Find & Traverse — walking the shape tree.

Other entries in this section