Change icon in a Matplotlib figure window

前端 未结 5 1170
难免孤独
难免孤独 2020-12-11 05:18

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

5条回答
  •  -上瘾入骨i
    2020-12-11 05:58

    For me the previous answer did not work, rather the following was required:

    from Tkinter import PhotoImage
    import matplotlib
    
    thismanager = matplotlib.pyplot.get_current_fig_manager()
    img = PhotoImage(file='filename.ppm')
    thismanager.window.tk.call('wm', 'iconphoto', thismanager.window._w, img)
    

提交回复
热议问题