Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to prompt for user input after all parameters have been specified for the script tool. I've seen many forum posts and stackexchange questions about this, and they all conclude that it's unnecessary, but I think my case is an exception. I want to give the user an opportunity to confirm data, such as how many sets of GPS coordinates there are. They will be yes/no questions ("is this data obviously incorrect?"), and the script tool parameter input form doesn't seem like it'd work well for this.

I know Tkinter's event handler causes problems with ArcGIS, and other framworks have similar problems. One workaround I found is to have your script call another script that runs as a separate process, and display the GUI from the second process, but that seems a little too hackish.

Edit: Apparently wxPython does work, but it's not included with python. I need to be able to distribute these scripts without any extra requirements other than ArcGIS, so that wouldn't work for me.

Edit 2: To clarify, the most important use would be to prompt the user when my software validation checks can't validate the data. For example, I have a list of IDs that I want to validate, but the format isn't consistent. I want to be able to prompt the user with a yes/no dialog if I can't validate in software (eg. the ID doesn't match one of the common patterns). It's possible that new ID formats will be created without my knowledge.

Edit 3: Another example: I have a file that contains, among other things, a table of start & stop times. I want to validate each row of the table individually, and cramming all of that data, plus the other checks, into the warning window would get ugly fast.

share|improve this question
11  
I would advise against it. Script tools are meant to be able to run without user interaction once you hit "Run". You might be able to provide more pertinent warning/error messages using validation code, however. –  blah238 Jan 10 '13 at 23:52
2  
You mention calling a sub-process as hackish, but as far as getting user input, I think this might be your only option if you're sticking with python script tools. The way that I would do it, if I absolutely had to have user interaction with a python script tool, is by calling a C# sub-process. If I recall, the python code will halt and wait for the sub-process to complete before continuing. This gives you the opportunity to include a limitless amount of user interaction built in C#. You can't pass objects to C# though, so you would have to get your data over in string form. –  egdetti Jan 10 '13 at 23:54
    
Although for the record I agree with blah238 –  egdetti Jan 10 '13 at 23:54
4  
This is exactly what validation in script tools is for. –  Luke Jan 10 '13 at 23:57
    
I thought the validation is only for scripted validation, and can't get user input? Can I display yes/no prompts from the validator, or something else that would have the same effect? –  user14144 Jan 11 '13 at 19:31
show 4 more comments

1 Answer 1

I am not sure, does this option can work for you or not, but may be you can think about creating a c# application.

  1. Do all user interaction and data validation through this application.
  2. After validating all data, run the python script.
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.