A Python toolbox (.pyt) is a simple text file that can be created, viewed, and edited in any text editor such as Notepad or VI, or any Python integrated development environment (IDE).
The toolbox is created as a class named Toolbox. In the Toolbox class' __init__ method, properties of the toolbox are defined, including the alias, label, and description. The name of the toolbox is defined by the name of the .pyt file. The tools property must be set to a list containing all tool classes defined in the toolbox.
Astuce :
To ensure the Python toolbox is recognized correctly, the toolbox class name must remain Toolbox.
By default, the Python toolbox template creates a stubbed-out tool named Tool. The template code used to create the Python toolbox is shown in The Python toolbox template topic.
- In the Catalog pane, click Toolboxes.
- Click New Python Toolbox.
- Browse to the folder where you want to save the Python toolbox, enter a name in the Name text box, and click Save.
Rubriques connexes
Vous avez un commentaire à formuler concernant cette rubrique ?