wtgeographer@gmail.com

Can not get text element to update?

Discussion created by wtgeographer@gmail.com on Mar 1, 2013
Latest reply on Mar 1, 2013 by wtgeographer@gmail.com
I can not get text element to update?

Text ELement has been added "Subdivision" Still not updating?...

class ButtonClass2(object):
    """Implementation for FemaMapper_addin.button (Button)"""
    def __init__(self):
        self.enabled = True
        self.checked = False
    def onClick(self):
        #set the map document reference
        mxd = arcpy.mapping.MapDocument("CURRENT")
        #set the dataframe reference using the map document and the first data frame in the list
        df = arcpy.mapping.ListDataFrames(mxd)[0]
        #set the layer reference using the map document reference and the second layer in the list of layers
        layer = arcpy.mapping.ListLayers(mxd)[1]
        #heading of the map
        map_title = "Parcel Map"
        #create a search cursor to get relevant information about a parcel
        sc = arcpy.SearchCursor(layer)
        #for loop to get the selected data
        for row in sc:
            #select the relevant fields to be put on the map
            Sub = row.getValue("SUBDIVISIO")
            

        #text element of the map
        elm = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "Heading")[0]
        elmSub = arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "Subdivision")[0]

        #font of the heading
        elm.text = '<FNT name ="Arial" size="32">' +  map_title + '</FNT>'
        elmSub.text = '<FNT name ="Arial" size="14">' + 'Subdivision: ' + Sub + '</FNT>'

        #Change the view to layout view
        arcpy.mapping.MapDocument("CURRENT").activeView = "PAGE_LAYOUT"
        #refresht the active view
        arcpy.RefreshActiveView()
        #delete search cursor and row variables
        del sc
        del row

Outcomes