python plt_如何使用Python最大化plt.show()窗口

由于我的信誉为零,因此我只能在运行Python 2.7.5和Matplotlib 1.3.1的Windows(WIN7)上留下新的答案。

我能够使用以下几行来最大化TkAgg,QT4Agg和wxAgg的Figure窗口:

from matplotlib import pyplot as plt

### for 'TkAgg' backend

plt.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' backend

plt.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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值