Select to view content in your preferred language

Add a confirm dialog box in arcpy

541
3
03-26-2024 05:18 AM
SumitMishra_016
Regular Contributor

I am using arcpy.da.SearchCursor. I want to add a confirm dialog box in arcpy to proceed further. Can I apply this in arcpy?

0 Kudos
3 Replies
Tom_Laue
Regular Contributor

I add something like this if I want to remind myself that I'm about to edit or overwrite critical data...

 

    answer = input("Do you want to continue? (yes/no): ").lower()
    if answer == "yes" or answer == "y":
        print("Continuing...")
        # Add your code here for further execution
    else:
        print("Exiting...")
        sys.exit()
BlakeTerhune
MVP Regular Contributor

If this is a standalone script that is run manually, then the solution from @Tom_Laue should work. Another option to consider is a script tool or Python toolbox.

0 Kudos
SumitMishra_016
Regular Contributor

Thanks for the reply @BlakeTerhune,

I am using Python toolbox, in that I need a confirm dialog box in between running the script, is that possible?

0 Kudos