pyqt如何获得以前的无花果管理器

问题描述 投票:1回答:1

我有如下图所示初始化的8位数字;

fig = [0, 0, 0, 0, 0, 0, 0, 0]
ax_i = [0, 0, 0, 0, 0, 0, 0, 0]
ax_temp = [0, 0, 0, 0, 0, 0, 0, 0]
ax_v = [0, 0, 0, 0, 0, 0, 0, 0]
ax_fan = [0, 0, 0, 0, 0, 0, 0, 0]

fig[0], (ax_i[0], ax_temp[0], ax_v[0], ax_fan[0]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[1], (ax_i[1], ax_temp[1], ax_v[1], ax_fan[1]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[2], (ax_i[2], ax_temp[2], ax_v[2], ax_fan[2]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[3], (ax_i[3], ax_temp[3], ax_v[3], ax_fan[3]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[4], (ax_i[4], ax_temp[4], ax_v[4], ax_fan[4]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[5], (ax_i[5], ax_temp[5], ax_v[5], ax_fan[5]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[6], (ax_i[6], ax_temp[6], ax_v[6], ax_fan[6]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)
fig[7], (ax_i[7], ax_temp[7], ax_v[7], ax_fan[7]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)

[当我调用单个图形时,我希望在以.png格式保存之前最大化图形。我使用以下方法来最大化图形窗口;

manager= plt.get_current_fig_manager()
manager.window.showMaximized()

问题是,这种方法有效并且仅使最后一个图形(即,图[7])最大化。>

fig[7], (ax_i[7], ax_temp[7], ax_v[7], ax_fan[7]) = plt.subplots(nrows = 4, ncols = 1, sharex = True)

似乎manager获得了最后一个数字的配置。我要如何最大化先前的数字,我的意思是说有类似的东西;

manager= plt.get_fig_manager(fig[i])
manager.window.showMaximized()

或者,我想要类似的东西;

manager= plt.get_fig_manager(fig[i])

而不是:

manager= plt.get_current_fig_manager()

否则,我该如何解决?

我有如下图所示初始化的8位数字;无花果= [0,0,0,0,0,0,0,0] ax_i = [0,0,0,0,0,0,0,0] ax_temp = [0,0,0,0,0 ,0,0,0] ax_v = [0,0,0,0,0,0,0,0] ax_fan = [0,0,0,0,0,...

python matplotlib pyqt pyqt5
1个回答
1
投票

如果您使用的后端是PyQt,并且您想获取所有matplotlib窗口,则可以使用topLevelWidgets()方法:

© www.soinside.com 2019 - 2024. All rights reserved.