@@ -1081,25 +1081,16 @@ def resize(self, width, height):
10811081
10821082def _load_bitmap (filename ):
10831083 """
1084- Load a bitmap file from the backends/images subdirectory in which the
1085- matplotlib library is installed. The filename parameter should not
1086- contain any path information as this is determined automatically.
1087-
1088- Returns a wx.Bitmap object.
1084+ Load a wx.Bitmap from a file in the "images" directory of the Matplotlib
1085+ data.
10891086 """
1090- path = cbook ._get_data_path ('images' , filename )
1091- if not path .exists ():
1092- raise IOError (f"Could not find bitmap file '{ path } '; dying" )
1093- return wx .Bitmap (str (path ))
1087+ return wx .Bitmap (str (cbook ._get_data_path ('images' , filename )))
10941088
10951089
10961090def _set_frame_icon (frame ):
10971091 bundle = wx .IconBundle ()
10981092 for image in ('matplotlib.png' , 'matplotlib_large.png' ):
1099- try :
1100- icon = wx .Icon (_load_bitmap (image ))
1101- except IOError :
1102- continue
1093+ icon = wx .Icon (_load_bitmap (image ))
11031094 if not icon .IsOk ():
11041095 return
11051096 bundle .AddIcon (icon )
@@ -1144,7 +1135,7 @@ def _init_toolbar(self):
11441135 self .wx_ids [text ] = (
11451136 self .AddTool (
11461137 - 1 ,
1147- bitmap = _load_bitmap (image_file + " .png" ),
1138+ bitmap = _load_bitmap (f" { image_file } .png" ),
11481139 bmpDisabled = wx .NullBitmap ,
11491140 label = text , shortHelp = text , longHelp = tooltip_text ,
11501141 kind = (wx .ITEM_CHECK if text in ["Pan" , "Zoom" ]
@@ -1325,8 +1316,7 @@ def set_history_buttons(self):
13251316class StatusBarWx (wx .StatusBar ):
13261317 """
13271318 A status bar is added to _FigureFrame to allow measurements and the
1328- previously selected scroll function to be displayed as a user
1329- convenience.
1319+ previously selected scroll function to be displayed as a user convenience.
13301320 """
13311321
13321322 def __init__ (self , parent , * args , ** kwargs ):
@@ -1356,7 +1346,7 @@ def add_toolitem(self, name, group, position, image_file, description,
13561346 tool = self .InsertTool (idx , - 1 , name , bmp , wx .NullBitmap , kind ,
13571347 description or "" )
13581348 else :
1359- size = (self .GetTextExtent (name )[0 ]+ 10 , - 1 )
1349+ size = (self .GetTextExtent (name )[0 ] + 10 , - 1 )
13601350 if toggle :
13611351 control = wx .ToggleButton (self , - 1 , name , size = size )
13621352 else :
0 commit comments