from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg import matplotlib, sys matplotlib.use('TkAgg') from numpy import arange, sin, pi from matplotlib.figure import Figure from Tkinter import * from pylab import * def plot_dist(ELEM, window): points = [] spline = 0 tag1 = "theline" def point(event): c.create_oval(event.x, event.y, event.x+1, event.y+1, fill="black") points.append(event.x) points.append(event.y) return points def canxy(event): print event.x, event.y def graph(event): global theline c.create_line(points, tags="theline") def toggle(event): global spline if spline == 0: c.itemconfigure(tag1, smooth=1) spline = 1 elif spline == 1: c.itemconfigure(tag1, smooth=0) spline = 0 return spline c = Canvas(window, bg="white", width=600, height= 400) c.configure(cursor="crosshair") c.pack() c.bind("", point) c.bind("", graph) c.bind("", toggle) ''' f = Figure(figsize=(5,4), dpi=100) a = f.add_subplot(111) t = arange(0.0,20.0,0.01) s = ELEM['dist'] a.plot(t,s) dataPlot = FigureCanvasTkAgg(f, master=window) dataPlot.show() dataPlot.get_tk_widget().pack(side='left', fill=BOTH, expand=1)''' #-------------------------------------------------------------------------------