I'm trying to make a python add-in toolbar that displays a graph. I can create a graph with a function in command line without any difficulty, but when I try to create the same graph from within a class for the add-in, it crashes. The crash happens whether the class is made in the command line or the add-in button. What happens is the graph appears, then a few seconds later, arcmap unexpectedly shuts down, and asks if I want to send an error report.
The class causing the crash is:
Does anyone have any workarounds that would let me display the graph while still creating it with an add-in button?
Thanks!
The class causing the crash is:
Code:
class ButtonClass15(object):
"""Implementation for WizardTest_addin.button (Button)"""
def __init__(self):
self.enabled = True
self.checked = False
def onClick(self):
allVals = ((1,1),(2,2),(3,3))
valArray = np.array (allVals)
rasterArray = valArray [:,0]
distanceArray = valArray [:,1]
pyplot.plot(distanceArray, rasterArray, 'r' )
pyplot.xlabel('Distance from Start')
pyplot.ylabel('Raster Val')
pyplot.show()
Does anyone have any workarounds that would let me display the graph while still creating it with an add-in button?
Thanks!