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()
Solved! Go to Solution.
import arcpy import pythonaddins import os from subprocess import Popen, PIPE class CreateNewXYPoint(object): """ Implementation for Create_New_Point_addin.createNewXYPoint (Button) """ def __init__(self): ... ... ... def onClick(self): self.GUI_response = open_GUI("GUI.py") self.returnedData = self.GUI_response.split(";") def open_GUI(file_name): file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), file_name) proc = Popen(file_path, shell=True, stdout=PIPE, bufsize=1) stdoutdata, stderrdata = proc.communicate() return stdoutdata
from Tkinter import * from ttk import * class GetXYPointInfoGUI(object): def __init__(self): # Your custom class gui = GetXYPointInfoGUI() print "{0};{1};{2}".format(gui.latitude,gui.longitude,gui.name)
import arcpy import pythonaddins import os from subprocess import Popen, PIPE class CreateNewXYPoint(object): """ Implementation for Create_New_Point_addin.createNewXYPoint (Button) """ def __init__(self): ... ... ... def onClick(self): self.GUI_response = open_GUI("GUI.py") self.returnedData = self.GUI_response.split(";") def open_GUI(file_name): file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), file_name) proc = Popen(file_path, shell=True, stdout=PIPE, bufsize=1) stdoutdata, stderrdata = proc.communicate() return stdoutdata
from Tkinter import * from ttk import * class GetXYPointInfoGUI(object): def __init__(self): # Your custom class gui = GetXYPointInfoGUI() print "{0};{1};{2}".format(gui.latitude,gui.longitude,gui.name)
import os #other code... pyplot.ylabel('Raster Val') fig1=pyplot.gcf() fig1.savefig(r'C:\Path\To\tempImage.png', dpi=100) os.system(r'"C:\Path\To\tempImage.png"')