Home/ Reference/ Layer & Shapes

layer.Delete() / layer.MoveTo(page)

Deletes the layer, or moves it to another page.

Signature

layer.Delete() / layer.MoveTo(page)

Notes

Deletes the layer, or moves it to another page.

Python example (runnable)

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

# create a scratch layer and delete it afterwards
tmp = page.Layers.Item(page.Layers.Count)
print("Layer to delete: ", tmp.Name)

# tmp.Delete()                          # delete the layer and its contents
# tmp.MoveTo(page)                      # or move the whole layer to another page
print("The delete and move lines are commented out; enable them once you are sure")

About this section: Layer & Shapes

Layer & Shapes — layers and shape creation.

Other entries in this section