Home/ Reference/ Geometry & Transform

shape.Delete()

Deletes. The object is gone afterwards; reading any property on it raises.

Signature

shape.Delete()

Notes

Deletes. The object is gone afterwards; reading any property on it raises.

Python example (runnable)

Requires pywin32. The example assumes app / doc / page / layer are already connected. See Connection & Init
Python
shape = app.ActiveSelectionRange(1)
print("Shapes on page before delete: ", doc.ActivePage.Shapes.Count)

shape.Delete()                           # after Delete the object is dead; stop reading its properties

print("After delete: ", doc.ActivePage.Shapes.Count)

About this section: Geometry & Transform

Geometry & Transform — position, size and rotation of shapes.

Other entries in this section