How to Set a Map Page Text Element Visibilty to False

605
0
11-30-2016 08:41 AM
DevinUnderwood2
Occasional Contributor

I am using data driven pages in which I want a text element only shown in the identified page.

However, when I change pages the text element is still visible.

import arcpy
mxd = arcpy.mapping.MapDocument("CURRENT")

# The text element is a textbox
elm = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "closeup")[0]
currentpage = mxd.dataDrivenPages.currentPageID

# (PAGE NAME 220 Also Known As (PAGE NUMBER 193) Must refer to PAGE NUMBER when scripting.
if currentpage == 193:
    elm.visible = True
elif currentpage != 193:
    elm.visible = False

arcpy.RefreshActiveView()
0 Kudos
0 Replies