gpt4 book ai didi

python - 在 matplotlib 图形窗口中禁用窗口最大化

转载 作者:太空宇宙 更新时间:2023-11-03 18:36:56 25 4
gpt4 key购买 nike

有没有可能的方法来禁用 matplotlib 图形窗口中的图形最大化按钮?我使用的是 Ubuntu 13.10。

最佳答案

好吧,如果您使用 PyQt 作为后端,您可以这样做:

import matplotlib.pyplot as plt
from PyQt4.QtCore import Qt

fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(range(10),range(10))

#get the parent window of the canvas and set the flags
fig.canvas.parent().setWindowFlags(
Qt.WindowSystemMenuHint|
Qt.WindowMinimizeButtonHint|
Qt.WindowCloseButtonHint)

plt.show()

通过这种方法,您可以使解决方案适应您的实际后端:只需获取 Canvas ,然后获取窗口父级(依赖于后端)并配置窗口(如果可能的话?)

关于python - 在 matplotlib 图形窗口中禁用窗口最大化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21382395/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com