1

ArcGIS 10.2 ships with MatPlotLib 1.1.1 installed. I am trying to display a non-blocking plot window.

Trials:

Launch an interactive plot in a Tk window from a toolbox. This causes the plot to display and the toolbox dialog continues to run in the foreground.

    import matplotlib.pyplot as plt

    fig = plt.figure()
    plt.plot(range(10), range(10))
    plt.show()

Changing plt.show() to plt.show(block=False) should make the plot non-blocking. This crashes ArcMap.

Attacking this from another direction - Create a python addin-in with a single button. That button executes the above code. Also crashes ArcMap.

Is it possible to get a non-blocking MatPlotLib plot via arcpy?

2
  • This is an issue with Tk's event loop conflicting with ArcGIS. TK expects that it is the only GUI loop running in the process. The only real 'work-around' (and more of a band-aid in my opinion) I've seen for using Tk in ArcGIS would be to create a python script GP tool and disable running the script in process (detailed here) Commented Jul 24, 2014 at 11:05
  • @EvilGenius Unfortunate to hear that that is the necessary route. Not surprising, but unfortunate. Commented Jul 24, 2014 at 14:03

1 Answer 1

2

This is an issue with Tk's event loop conflicting with ArcGIS. TK expects that it is the only GUI loop running in the process.

The only real 'work-around' (and more of a band-aid in my opinion) I've seen for using Tk in ArcGIS would be to create a python script GP tool and disable running the script in process. This is detailed in Another GIS Blog post titled Python Add-Ins and Tkinter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.