Select to view content in your preferred language

Is Python Toolbox Tool Foreground Execution possible with Access to the Map?

762
3
01-15-2023 01:36 PM
Manu
by
Regular Contributor

I have some Python Toolbox for ArcMap 10.8. Now I want the user to check an output and to give feedback before the tool continues. The purpose of this is to adjust a threshold value to create a mask from a raster with continuous values.
To this end, I used a Tkinter prompt that creates a window in which a user can enter information. The mask is calculated and displayed on the map. Subsequently, the user can adjust the threshold value and create a new mask based on that new value.

My problem is that running the tool in the background leads to failure of the code. The window is not displayed and the tool returns an error. When running in the foreground, however, the user cannot access the map. To inspect the mask and to decide about a new threshold value, the user must be able to view the mask on the map.

Is there a way to run the tool in background part of the time or to display the Tkinter window in the foreground while the tool main window is hidden?

Tags (2)
0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

why not split the process into a prep stage and an execute stage.

"Tasks" are designed for this sort of thing

Design a task item—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos
Manu
by
Regular Contributor

I am interested in a rather interactive behaviour of the tool, so the process should accept an arbitrary number of updates of the threshold value. The Tkinter window opens with a slider on it and users should be able to try various values, where the results could be almost updated in real time. This preferrable behaviour would be possible if ArcMap didn't lock the main window during Tool execution...

0 Kudos
DanPatterson
MVP Esteemed Contributor

Perhaps Arcobjects allows for such behaviour.  You can look at the non-python SDKs to see if what you would like is possible within arcmap or pro


... sort of retired...
0 Kudos