Change icon in a Matplotlib figure window

前端 未结 5 1171
难免孤独
难免孤独 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条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-11 05:37

    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")
    

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

提交回复
热议问题