RefreshTOC
Récapitulatif
Refreshes the table of contents.
Discussion
If Python is used to modify the table of contents within the current map document (e.g., change a layer name), the map will not automatically update with the changes. RefreshTOC is only needed if you want to see the table of contents updated.
Syntaxe
RefreshTOC ()
Exemple de code
RefreshTOC example
A simple script run from the Python window that demonstrates how to update the Table of Contents and force a refresh to make the change visible.
import arcpy # Create a MapDocument object from the current map mxd = arcpy.mapping.MapDocument("CURRENT") # Update the layer name of the first layer in the Table of Contents arcpy.mapping.ListLayers(mxd)[0].name = "New Layer Name" # Refresh the Table of Contents to reflect the change arcpy.RefreshTOC() del mxd
7/10/2012