AnsweredAssumed Answered

Text_Element does not change arcpy.mapping.MapDocument

Question asked by Omasan_OSRL on Jul 30, 2018
Latest reply on Jul 30, 2018 by xander_bakker

I cannot get my Text_Element to change as my layer changes.  My code is set to iterate through my map document turning layers on, exporting jpegs and turning layers off before moving to the next layer.  The code exports the layers but the Text_Element does not change as the layers change:


#Set text elements
def modifyText(mxd):
    for lyr in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
        layername = lyr.dataSource if lyr.supports('dataSource') else ""
        (drive, path) = os.path.splitdrive(dataSource)
        (path,filename) = os.path.split(path)
        file = os.path.splitext(filename)
        path_list = path.split(os.sep)
        a = text_elm
        a.text = ("Data Source:"+str(filename))
        a.elementPositionX = 6.6548
        a.elementPositionY = 2.969
mxd = arcpy.mapping.MapDocument(r"C:\Users\oakporiaye\Desktop\GIS Folder\Python Geoprocessing Scripts\Sensitivity_Mapping_Script\GEOM0000.mxd")
Toggle(mxd, True)