@@ -59,6 +59,13 @@ def cursord(self):
5959 except TypeError as exc :
6060 return {}
6161
62+ icon_filename = _api .deprecated ("3.6" , obj_type = "" )(property (
63+ lambda self :
64+ "matplotlib.png" if sys .platform == "win32" else "matplotlib.svg" ))
65+ window_icon = _api .deprecated ("3.6" , obj_type = "" )(property (
66+ lambda self :
67+ str (cbook ._get_data_path ("images" , __getattr__ ("icon_filename" )))))
68+
6269
6370@functools .lru_cache ()
6471def _mpl_to_gtk_cursor (mpl_cursor ):
@@ -307,7 +314,9 @@ def __init__(self, canvas, num):
307314 super ().__init__ (canvas , num )
308315
309316 self .window .set_wmclass ("matplotlib" , "Matplotlib" )
310- self .window .set_icon_from_file (window_icon )
317+ icon_ext = "png" if sys .platform == "win32" else "svg"
318+ self .window .set_icon_from_file (
319+ str (cbook ._get_data_path (f"images/matplotlib.{ icon_ext } " )))
311320
312321 self .vbox = Gtk .Box ()
313322 self .vbox .set_property ("orientation" , Gtk .Orientation .VERTICAL )
@@ -698,14 +707,6 @@ def trigger(self, *args, **kwargs):
698707 clipboard .set_image (pb )
699708
700709
701- # Define the file to use as the GTk icon
702- if sys .platform == 'win32' :
703- icon_filename = 'matplotlib.png'
704- else :
705- icon_filename = 'matplotlib.svg'
706- window_icon = str (cbook ._get_data_path ('images' , icon_filename ))
707-
708-
709710def error_msg_gtk (msg , parent = None ):
710711 if parent is not None : # find the toplevel Gtk.Window
711712 parent = parent .get_toplevel ()
0 commit comments