在Matplotlib图窗口中更改图标 [英] Change icon in a Matplotlib figure window

查看:131
本文介绍了在Matplotlib图窗口中更改图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以更改Matplotlibe图形窗口的图标?我的应用程序有一个按钮,用于打开带有图形的图形窗口(使用Matplotlib创建)。我设法修改了应用程序图标,但图形窗口仍然有Tk图标,典型的Tkinter。

Is it possible to change the icon of a Matplotlibe figure window? My application has a button that opens a Figure window with a graph (created with Matplotlib). I managed to modify the application icon, but the figure window still has the 'Tk' icon, typical of Tkinter.

推荐答案

我以这种方式解决了这个问题:
之前我按下按钮创建数字 imshow() show(),我用这种方式初始化数字:

I solved it in this way: BEFORE I press the button that creates the figure with imshow() and show(), I initialize the figure in this way:

plt.Figure()
thismanager = get_current_fig_manager()
thismanager.window.wm_iconbitmap("icon.ico")

所以当我按 show()该窗口有我想要的图标。

so when I press show() the window has the icon I want.

这篇关于在Matplotlib图窗口中更改图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆