ArcGIS Desktop

  • 文档
  • 支持

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS for Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

SetProgressor

  • 摘要
  • 说明
  • 语法
  • 代码示例

摘要

建立一个进度条对象将进度信息传递至进度对话框。可通过选择默认进度条或步长进度条来控制进度对话框的外观。

说明

由于脚本工具共享了应用程序,因此您可以控制进度对话框。您可以通过选择默认进度条或步骤进度条来控制进度对话框的外观,如下图所示。

默认进度条和步骤进度条

语法

SetProgressor (type, {message}, {min_range}, {max_range}, {step_value})
参数说明数据类型
type

进度条类型(默认或步骤)。

  • default —进度条连续向后或向前移动。
  • step —进度条显示完成百分比。

(默认值为 default)

String
message

进度条标注。默认情况下没有标注。

String
min_range

进度条的开始值。默认值为 0。

(默认值为 0)

Integer
max_range

进度条的结束值。默认值为 100。

(默认值为 100)

Integer
step_value

用于更新进度条的进度条步长间隔。

(默认值为 1)

Integer

代码示例

SetProgressor 示例

设置进度条对象以在进度对话框中显示进度。

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()

相关主题

  • ResetProgressor
  • SetProgressorLabel
  • SetProgressorPosition
  • 控制进度对话框

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS 平台

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • 内部人员博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2018 Esri. | 隐私政策 | 法律声明