Add a confirm dialog box in arcpy

278
3
03-26-2024 05:18 AM
sumalain1
New Contributor III

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
New Contributor III

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
sumalain1
New Contributor III

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