Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
share|improve this question
    
Figured it out. Now realizing you need all text elements in map to update any of them. –  wtgeographer Mar 1 '13 at 19:44
    
Could you post your solution code as an answer and mark it as correct so others can find it in the future? –  om_henners Mar 15 '13 at 1:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.