_tkinter.TclError:错误#args:应该是“wm属性窗口”

时间:2021-01-20 23:39:50

i'm using python 3.6 on linux, and i was using matplotlib version 1.5.1, so i updated it to latest version 2.2.2

我在linux上使用python 3.6,我使用matplotlib 1.5.1版,所以我将其更新到最新版本2.2.2

Then there was a problem with a simple code.

然后是一个简单代码的问题。

import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()

when i run this code, error occurred with this message. (the picture popped in a second then it disappeared quickly)

当我运行此代码时,此消息发生错误。 (图片弹出一秒然后很快就消失了)

self.canvas.manager.window.attributes('-topmost', 1) File "/home/taegyu/tkinter/init.py", line 1782, in wm_attributes return self.tk.call(args) _tkinter.TclError: wrong # args: should be "wm attributes window"

self.canvas.manager.window.attributes(' - topmost',1)文件“/home/taegyu/tkinter/init.py”,第1782行,在wm_attributes中返回self.tk.call(args)_tkinter.TclError:错误#args:应该是“wm属性窗口”

After reinstalling with matplotlib version 1.5, I do not see any problem. I think it's probably a problem with tkinter and matplotlib crashes. But i don't know exactly problem and what should i do for this. Can anyone solve this problem?

使用matplotlib 1.5版重新安装后,我没有看到任何问题。我认为这可能是tkinter和matplotlib崩溃的问题。但我不知道确切的问题,我应该为此做些什么。有谁能解决这个问题?

1 个解决方案

#1


0  

Try a different backend, for instance GTK:

尝试使用不同的后端,例如GTK:

import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()

#1


0  

Try a different backend, for instance GTK:

尝试使用不同的后端,例如GTK:

import matplotlib
matplotlib.use('GTKAgg')
import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.show()