@@ -1079,25 +1079,16 @@ def resize(self, width, height):
10791079
10801080def _load_bitmap (filename ):
10811081 """
1082- Load a bitmap file from the backends/images subdirectory in which the
1083- matplotlib library is installed. The filename parameter should not
1084- contain any path information as this is determined automatically.
1085-
1086- Returns a wx.Bitmap object.
1082+ Load a wx.Bitmap from a file in the "images" directory of the Matplotlib
1083+ data.
10871084 """
1088- path = cbook ._get_data_path ('images' , filename )
1089- if not path .exists ():
1090- raise IOError (f"Could not find bitmap file '{ path } '; dying" )
1091- return wx .Bitmap (str (path ))
1085+ return wx .Bitmap (str (cbook ._get_data_path ('images' , filename )))
10921086
10931087
10941088def _set_frame_icon (frame ):
10951089 bundle = wx .IconBundle ()
10961090 for image in ('matplotlib.png' , 'matplotlib_large.png' ):
1097- try :
1098- icon = wx .Icon (_load_bitmap (image ))
1099- except IOError :
1100- continue
1091+ icon = wx .Icon (_load_bitmap (image ))
11011092 if not icon .IsOk ():
11021093 return
11031094 bundle .AddIcon (icon )
@@ -1142,7 +1133,7 @@ def _init_toolbar(self):
11421133 self .wx_ids [text ] = (
11431134 self .AddTool (
11441135 - 1 ,
1145- bitmap = _load_bitmap (image_file + " .png" ),
1136+ bitmap = _load_bitmap (f" { image_file } .png" ),
11461137 bmpDisabled = wx .NullBitmap ,
11471138 label = text , shortHelp = text , longHelp = tooltip_text ,
11481139 kind = (wx .ITEM_CHECK if text in ["Pan" , "Zoom" ]
@@ -1323,8 +1314,7 @@ def set_history_buttons(self):
13231314class StatusBarWx (wx .StatusBar ):
13241315 """
13251316 A status bar is added to _FigureFrame to allow measurements and the
1326- previously selected scroll function to be displayed as a user
1327- convenience.
1317+ previously selected scroll function to be displayed as a user convenience.
13281318 """
13291319
13301320 def __init__ (self , parent , * args , ** kwargs ):
@@ -1354,7 +1344,7 @@ def add_toolitem(self, name, group, position, image_file, description,
13541344 tool = self .InsertTool (idx , - 1 , name , bmp , wx .NullBitmap , kind ,
13551345 description or "" )
13561346 else :
1357- size = (self .GetTextExtent (name )[0 ]+ 10 , - 1 )
1347+ size = (self .GetTextExtent (name )[0 ] + 10 , - 1 )
13581348 if toggle :
13591349 control = wx .ToggleButton (self , - 1 , name , size = size )
13601350 else :
0 commit comments