Exception in Tkinter callback

  • 问题描述:用matplotlib绘制了一张图,并同时保存为三种格式。
###################
# 图像设置
##################
plt.tight_layout()
plt.savefig('./a.jpeg',dpi=1200,bbox_inches='tight')
plt.savefig('./b.pdf',dpi=1200,bbox_inches='tight')
plt.savefig('./c.tif',dpi=1200,bbox_inches='tight')

plt.show()

代码正确执行了,但是遇到以下提示:

Exception in Tkinter callback
Traceback (most recent call last):
  File "E:\software-setups\anaconda\envs\tensorflow_114\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "E:\software-setups\anaconda\envs\tensorflow_114\lib\tkinter\__init__.py", line 749, in callit
    func(*args)
  File "E:\software-setups\anaconda\envs\tensorflow_114\lib\site-packages\matplotlib\backends\_backend_tk.py", line 270, in idle_draw
    self.draw()
  File "E:\software-setups\anaconda\envs\tensorflow_114\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 9, in draw
    super(FigureCanvasTkAgg, self).draw()
  File "E:\software-setups\anaconda\envs\tensorflow_114\lib\site-packages\matplotlib\backends\backend_agg.py", line 393, in draw
    self.figure.draw(self.renderer)
  File "E:\software-setups\anaconda\envs\tensorflow_114\lib\site-packages\matplotlib\backend_bases.py", line 1535, in _draw
    def _draw(renderer): raise Done(renderer)
matplotlib.backend_bases._get_renderer..Done: 

能忍吗?当然不能忍。

  • 解决方法:测试发现,如果减少同时保存的图像的张数,提示就不再出现了。

 

 

你可能感兴趣的:(Exception in Tkinter callback)