ResetProgressor (arcpy)

摘要

Resets the progressor back to its initial state.

语法

ResetProgressor ()

代码实例

ResetProgressor example

Reset progress dialog box to initial state.

import arcpy
from arcpy import env
 
# Allow overwriting of output 
# 
env.overwriteOutput = 1
 
# Set current workspace 
# 
env.workspace = "c:/data" 

# Get a list of shapefiles in folder 
# 
fcs = arcpy.ListFeatureClasses() 

# Find the total count of shapefiles in list 
# 
fcCount = len(fcs) 

# Set the progressor 
#
arcpy.SetProgressor("step", "Copying shapefiles to geodatabase...", 0,fcCount, 1) 

# Create a file gdb to contain new feature classes 
#
arcpy.CreateFileGDB(env.workspace, "fgdb.gdb") 

# For each shapefile, copy to a file geodatabase 
# 
for shp in fcs: 
  # Trim the '.shp' extension 
  # 
  fc = shp.rstrip(".shp") 

  # Update the progressor label for current shapefile 
  # 
  arcpy.SetProgressorLabel("Loading " + shp + "...") 

  # Copy the data 
  # 
  arcpy.CopyFeatures(shp, "fgdb.gdb/" + fc) 

  # Update the progressor position 
  # 
  arcpy.SetProgressorPosition()

arcpy.ResetProgressor()

相关主题

9/15/2013