@@ -56,6 +56,7 @@ class __getattr__:
5656 }))
5757
5858
59+ @_api .deprecated ("3.6" )
5960def error_msg_wx (msg , parent = None ):
6061 """Signal an error condition with a popup error dialog."""
6162 dialog = wx .MessageDialog (parent = parent ,
@@ -1153,15 +1154,15 @@ def save_figure(self, *args):
11531154 # Fetch the required filename and file type.
11541155 filetypes , exts , filter_index = self .canvas ._get_imagesave_wildcards ()
11551156 default_file = self .canvas .get_default_filename ()
1156- dlg = wx .FileDialog (
1157+ dialog = wx .FileDialog (
11571158 self .canvas .GetParent (), "Save to file" ,
11581159 mpl .rcParams ["savefig.directory" ], default_file , filetypes ,
11591160 wx .FD_SAVE | wx .FD_OVERWRITE_PROMPT )
1160- dlg .SetFilterIndex (filter_index )
1161- if dlg .ShowModal () == wx .ID_OK :
1162- path = pathlib .Path (dlg .GetPath ())
1161+ dialog .SetFilterIndex (filter_index )
1162+ if dialog .ShowModal () == wx .ID_OK :
1163+ path = pathlib .Path (dialog .GetPath ())
11631164 _log .debug ('%s - Save file path: %s' , type (self ), path )
1164- fmt = exts [dlg .GetFilterIndex ()]
1165+ fmt = exts [dialog .GetFilterIndex ()]
11651166 ext = path .suffix [1 :]
11661167 if ext in self .canvas .get_supported_filetypes () and fmt != ext :
11671168 # looks like they forgot to set the image type drop
@@ -1176,7 +1177,11 @@ def save_figure(self, *args):
11761177 try :
11771178 self .canvas .figure .savefig (str (path ), format = fmt )
11781179 except Exception as e :
1179- error_msg_wx (str (e ))
1180+ dialog = wx .MessageDialog (
1181+ parent = self .canvas .GetParent (), message = str (e ),
1182+ caption = 'Matplotlib error' )
1183+ dialog .ShowModal ()
1184+ dialog .Destroy ()
11801185
11811186 def draw_rubberband (self , event , x0 , y0 , x1 , y1 ):
11821187 height = self .canvas .figure .bbox .height
0 commit comments