Exception with FuncAnimation


My matplotlib script, that runs on Windows, runs to annimations:

anim = []

anim.append( matplotlib.animation.FuncAnimation(fig_ul, updatePlots_ul, frames=None, interval=100, repeat=True) )
anim.append( matplotlib.animation.FuncAnimation(fig_dl, updatePlots_dl, frames=None, interval=100, repeat=True) )

plt.show() # line 476

When I terminate the script by closing one of the figures I get an exception:

Traceback (most recent call last):
  File "tcpClient.py", line 476, in <module>
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\pyplot.py", line 253, in show
    return _show(*args, **kw)
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backend_bases.py", line 163, in __call__
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 610, in show
    self.canvas.manager.window.attributes('-topmost', 1)
AttributeError: 'NoneType' object has no attribute 'attributes'

How could I improve my code to avoid this untidy exception?

Best regards


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170717/fae9f98d/attachment.html>