亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

AttributeError:“FigureManagerBase”對象沒有屬性“window”

AttributeError:“FigureManagerBase”對象沒有屬性“window”

慕的地8271018 2022-07-26 20:55:29
我已經很好地使用了下面的 python 代碼,但是當我重新安裝 Anaconda python 2.7 版本時,該代碼有錯誤。為什么會這樣?plt.subplots_adjust(top=0.9, bottom=0.05, left=0.05, right=0.95, wspace=0.55, hspace=0.2)plt.figtext(0.5, 0.95, str(os.path.basename(self.filepath)),ha='center', color='black', weight='bold', size='small')mngr = plt.get_current_fig_manager()mngr.window.setGeometry(810, 30, 800, 800)show()Traceback (most recent call last):  File "C:\Users\hyeyoung\Desktop\20200211MHyeyoung.py", line 4482, in onOpenImageFile    self.ShowAFewFrames()  File "C:\Users\hyeyoung\Desktop\20200211MHyeyoung.py", line 4509, in ShowAFewFrames    mngr.window.setGeometry(810,30,800, 800)AttributeError: 'FigureManagerBase' object has no attribute 'window'--------------------------------------------------------------------------Anaconda python ver. : 2.7matplotlib ver. :2.2.2please give me an answer. thx
查看完整描述

1 回答

?
炎炎設計

TA貢獻1808條經驗 獲得超4個贊

您假設plt.get_current_fig_manager()返回一個具有window屬性的對象。Qt4Agg只有在使用, 或Qt5Agg(或Qt4CairoQt5Cairo)后端時才會出現這種情況,因為在這種情況下,圖形管理器是 a FigureManagerQT,它是QtWidgets.QWidgetQt 小部件的子類,并且具有window屬性。

因此,如果您想使用該屬性,請確保使用相應的后端,例如

matplotlib.use("Qt5Agg")


查看完整回答
反對 回復 2022-07-26
  • 1 回答
  • 0 關注
  • 278 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號