@@ -1079,25 +1079,16 @@ def resize(self, width, height):
1079
1079
1080
1080
def _load_bitmap (filename ):
1081
1081
"""
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.
1087
1084
"""
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 )))
1092
1086
1093
1087
1094
1088
def _set_frame_icon (frame ):
1095
1089
bundle = wx .IconBundle ()
1096
1090
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 ))
1101
1092
if not icon .IsOk ():
1102
1093
return
1103
1094
bundle .AddIcon (icon )
@@ -1142,7 +1133,7 @@ def _init_toolbar(self):
1142
1133
self .wx_ids [text ] = (
1143
1134
self .AddTool (
1144
1135
- 1 ,
1145
- bitmap = _load_bitmap (image_file + " .png" ),
1136
+ bitmap = _load_bitmap (f" { image_file } .png" ),
1146
1137
bmpDisabled = wx .NullBitmap ,
1147
1138
label = text , shortHelp = text , longHelp = tooltip_text ,
1148
1139
kind = (wx .ITEM_CHECK if text in ["Pan" , "Zoom" ]
@@ -1323,8 +1314,7 @@ def set_history_buttons(self):
1323
1314
class StatusBarWx (wx .StatusBar ):
1324
1315
"""
1325
1316
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.
1328
1318
"""
1329
1319
1330
1320
def __init__ (self , parent , * args , ** kwargs ):
@@ -1354,7 +1344,7 @@ def add_toolitem(self, name, group, position, image_file, description,
1354
1344
tool = self .InsertTool (idx , - 1 , name , bmp , wx .NullBitmap , kind ,
1355
1345
description or "" )
1356
1346
else :
1357
- size = (self .GetTextExtent (name )[0 ]+ 10 , - 1 )
1347
+ size = (self .GetTextExtent (name )[0 ] + 10 , - 1 )
1358
1348
if toggle :
1359
1349
control = wx .ToggleButton (self , - 1 , name , size = size )
1360
1350
else :
0 commit comments