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()