0

I would like to generate a tool in Python-Addin ArcGIS as the image attached. I also like to generate the save and load button in the tool. My purpose is that when the user chooses the range parameters and then clicks the save button, those parameters can be saved and next time if the user would like to reuse the parameter, they can load it. This is my python script but I do not know which types of python-addin should be put in my scriptenter image description here

    import arcpy, arcgisscripting,math
    import pythonaddins
    import  pandas as pd
    import os, glob

    from arcpy import env
    arcpy.env.overwriteOutput = True
    arcpy.CheckOutExtension("Spatial")
    from arcpy.sa import *

    input=arcpy.GetParameterAsText(0)
    range_1=arcpy.GetParameterAsText(1)
    range_2=arcpy.GetParameterAsText(2)
    output=arcpy.GetParameterAsText(3)

    if (range_2==''):
       outFocalStat = FocalStatistics(input, NbrAnnulus(range_1, range_1, "CELL"),
                           "MINORITY", "NODATA")
    else:
       outFocalStat= FocalStatistics(input, NbrAnnulus(range_2, range_2, "CELL"),
                           "MINORITY", "NODATA")

    outFocalSat.save(output)
2
  • 1
    Customizing a script tool like that isn't possible. An alternative route could be adding a "remember" checkbox which writes out the settings, then loading them on tool open through validation
    – mikewatt
    Nov 24 '20 at 23:35
  • @mikewatt: Thank you for your suggestion. If it is possible, could you please write a code how to add a remember checkbox? Thank you.
    – user30985
    Nov 25 '20 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.