当年话下
由于我的信誉为零,因此我只能在运行Python 2.7.5和Matplotlib 1.3.1的Windows(WIN7)上留下新的答案。我能够使用以下几行来最大化TkAgg,QT4Agg和wxAgg的Figure窗口:from matplotlib import pyplot as plt### for 'TkAgg' backendplt.figure(1)plt.switch_backend('TkAgg') #TkAgg (instead Qt4Agg)print '#1 Backend:',plt.get_backend()plt.plot([1,2,6,4])mng = plt.get_current_fig_manager()### works on Ubuntu??? >> did NOT working on windows# mng.resize(*mng.window.maxsize())mng.window.state('zoomed') #works fine on Windows!plt.show() #close the figure to run the next section### for 'wxAgg' backendplt.figure(2)plt.switch_backend('wxAgg')print '#2 Backend:',plt.get_backend()plt.plot([1,2,6,4])mng = plt.get_current_fig_manager()mng.frame.Maximize(True)plt.show() #close the figure to run the next section### for 'Qt4Agg' backendplt.figure(3)plt.switch_backend('QT4Agg') #default on my systemprint '#3 Backend:',plt.get_backend()plt.plot([1,2,6,4])figManager = plt.get_current_fig_manager()figManager.window.showMaximized()plt.show()希望将以上答案的摘要(和一些补充内容)合并到一个有效的示例中(至少对于Windows是有用的)。干杯