Visitar URL original
Fixes #3 A spectrum figure closing was not triggering the closing cas… · magnunor/matplotlib@4ac4080 · GitHub
Skip to content

Commit 4ac4080

Browse files
committed
Fixes matplotlib#3 A spectrum figure closing was not triggering the closing cascade
1 parent f0aff64 commit 4ac4080

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎lib/drawing/spectrum.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def __init__(self):
5353

5454
def create_figure(self):
5555
self.figure = utils.create_figure()
56+
utils.on_window_close(self.figure, self.close)
5657

5758
def create_left_axis(self):
5859
self.left_ax = self.figure.add_subplot(111)
@@ -161,13 +162,12 @@ def update(self):
161162
self.ax.figure.canvas.draw()
162163

163164
def close(self):
164-
self.ax.lines.remove(self.line)
165+
if self.line in self.ax.lines:
166+
self.ax.lines.remove(self.line)
165167
self.coordinates.disconnect(self.update)
166168
try:
167169
self.ax.figure.canvas.draw()
168170
except:
169171
pass
170172

171-
172-
173173
plt.show()

0 commit comments

Comments
 (0)