ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Aide
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plateforme cartographique de votre organisation

ArcGIS Desktop

Un SIG professionnel complet

ArcGIS Enterprise

SIG dans votre entreprise

ArcGIS Developers

Outils de création d'applications de localisation

ArcGIS Solutions

Modèles d'applications et de cartes gratuits pour votre secteur d'activité

ArcGIS Marketplace

Téléchargez des applications et des données pour votre organisation.

  • Documentation
  • Support
Esri
  • Se connecter
user
  • Mon profil
  • Déconnexion

ArcMap

  • Accueil
  • Commencer
  • Carte
  • Analyser
  • Gérer les données
  • Outils
  • Extensions

SetProgressor

  • Résumé
  • Discussion
  • Syntaxe
  • Exemple de code

Résumé

Establishes a progressor object which allows progress information to be passed to a progress dialog box. The appearance of the progress dialog box can be controlled by choosing either the default progressor or the step progressor.

Discussion

Since script tools share the application, you have control of the progress dialog box. You can control the appearance of the progress dialog box by choosing either the default progressor or the step progressor, as illustrated below.

Default and step progressor

Syntaxe

SetProgressor (type, {message}, {min_range}, {max_range}, {step_value})
ParamètreExplicationType de données
type

The progressor type (default or step).

  • default —The progressor moves back and forth continuously.
  • step —The progressor shows the percentage complete.

(La valeur par défaut est default)

String
message

The progressor label. The default is no label.

String
min_range

Starting value for progressor. Default is 0.

(La valeur par défaut est 0)

Integer
max_range

Ending value for progressor. Default is 100.

(La valeur par défaut est 100)

Integer
step_value

The progressor step interval for updating the progress bar.

(La valeur par défaut est 1)

Integer

Exemple de code

SetProgressor example

Set progressor object for displaying progress in the progress dialog box.

import os
import arcpy

# Allow overwriting of output
arcpy.env.overwriteOutput = True

# Set current workspace
arcpy.env.workspace = "c:/data"

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

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

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

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

# For each shapefile, copy to a file geodatabase
for shp in fcs:
    # Trim the '.shp' extension
    fc = os.path.splitext(shp)[0]

    # Update the progressor label for current shapefile
    arcpy.SetProgressorLabel("Loading {0}...".format(shp))

    # Copy the data
    arcpy.CopyFeatures_management(shp, os.path.join("fgdb.gdb", fc))

    # Update the progressor position
    arcpy.SetProgressorPosition()

arcpy.ResetProgressor()

Rubriques connexes

  • ResetProgressor
  • SetProgressorLabel
  • SetProgressorPosition
  • Contrôle de la boîte de dialogue de progression

ArcGIS Desktop

  • Accueil
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

A propos d'Esri

  • A propos de la société
  • Carrières
  • Blog d’Esri
  • Conférence des utilisateurs
  • Sommet des développeurs
Esri
Donnez-nous votre avis.
Copyright © 2021 Esri. | Confidentialité | Légal