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?

  • 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) – Evil Genius Jul 24 '14 at 11:05
  • @EvilGenius Unfortunate to hear that that is the necessary route. Not surprising, but unfortunate. – Jay Laura Jul 24 '14 at 14:03
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, privacy policy and cookie policy

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