Skip to content
Snippets Groups Projects
Commit 5a275ff7 authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Move readout to label widget on plot

parent acc019fa
Branches
Tags
1 merge request!921Add interactive task plot script.
...@@ -499,8 +499,11 @@ class Container: ...@@ -499,8 +499,11 @@ class Container:
wcanvas.config(width=1000, height=300) wcanvas.config(width=1000, height=300)
wcanvas.pack(side=tk.TOP, expand=True, fill=tk.BOTH) wcanvas.pack(side=tk.TOP, expand=True, fill=tk.BOTH)
toolbar= tkagg.NavigationToolbar2TkAgg(canvas, self.window) toolbar = tkagg.NavigationToolbar2TkAgg(canvas, self.window)
toolbar.update() toolbar.update()
self.output = tk.StringVar()
label = tk.Label(self.window, textvariable=self.output, bg="white", fg="red", bd=2)
label.pack(side=tk.RIGHT, expand=True, fill=tk.X)
wcanvas.pack(side=tk.TOP, expand=True, fill=tk.BOTH) wcanvas.pack(side=tk.TOP, expand=True, fill=tk.BOTH)
canvas.draw() canvas.draw()
...@@ -512,12 +515,7 @@ class Container: ...@@ -512,12 +515,7 @@ class Container:
fig.canvas.mpl_connect('button_press_event', self.onclick) fig.canvas.mpl_connect('button_press_event', self.onclick)
def onclick(self, event): def onclick(self, event):
#print('%s click: button=%d, x=%d, y=%d, xdata=%f, ydata=%f' % # Find thread, then scan for bounded task.
# ('double' if event.dblclick else 'single', event.button,
# event.x, event.y, event.xdata, event.ydata))
# Find thread, then scan for task.
# XXX are sorted by tic? If so could break earlier.
try: try:
thread = int(round(event.ydata)) - 1 thread = int(round(event.ydata)) - 1
if thread >= 0 and thread < self.nthread: if thread >= 0 and thread < self.nthread:
...@@ -526,7 +524,10 @@ class Container: ...@@ -526,7 +524,10 @@ class Container:
labels = self.llabels[thread] labels = self.llabels[thread]
for i in range(len(tics)): for i in range(len(tics)):
if event.xdata > tics[i] and event.xdata < tocs[i]: if event.xdata > tics[i] and event.xdata < tocs[i]:
print "task = ", labels[i], " tic/toc = ", tics[i], "/", tocs[i] tic = "{0:.3f}".format(tics[i])
toc = "{0:.3f}".format(tocs[i])
outstr = "task = " + labels[i] + ", tic/toc = " + tic + " / " + toc
self.output.set(outstr)
break break
except TypeError: except TypeError:
# Ignore out of bounds. # Ignore out of bounds.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment