python matplotlib窗口.setGeometry给我错误FigureManagerBase“object没有属性”“window”

2024-09-24 22:29:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图运行代码,但遇到了一个错误

> AttributeError                            Traceback (most recent call last) <ipython-input-10-744f62dd690f> in <module>()
      4         fig, ax =plt.subplots(1)
      5         mngr = plt.get_current_fig_manager()
----> 6         mngr.window.setGeometry(250, 120, 1280, 1024)
      7         image =cv2.imread(image_file.path)
      8         image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB)

AttributeError: 'FigureManagerBase' object has no attribute 'window'

我试图更改后端,并尝试在spyder和jupyter中运行代码,但没有任何帮助。我使用的是Windows7和Python3。我的代码在下面

^{pr2}$

Tags: 代码imagemost错误ipythonfigpltcall