@@ -715,6 +715,10 @@ def __init__(self, parent, id, figure):
715715
716716 self .Printer_Init ()
717717
718+ def Destroy (self , * args , ** kwargs ):
719+ wxPanel .Destroy (self , * args , ** kwargs )
720+
721+
718722 def Copy_to_Clipboard (self , event = None ):
719723 "copy bitmap of canvas to system clipboard"
720724 bmp_obj = wx .BitmapDataObject ()
@@ -1240,7 +1244,12 @@ def _onClose(self, evt):
12401244 def GetToolBar (self ):
12411245 """Override wxFrame::GetToolBar as we don't have managed toolbar"""
12421246 return self .toolbar
1243-
1247+
1248+ def Destroy (self , * args , ** kwargs ):
1249+ wxFrame .Destroy (self , * args , ** kwargs )
1250+ if self .toolbar is not None :
1251+ self .toolbar .Destroy ()
1252+
12441253class FigureManagerWx (FigureManagerBase ):
12451254 """
12461255 This class contains the FigureCanvas and GUI frame
@@ -1270,6 +1279,8 @@ def notify_axes_change(fig):
12701279 def destroy (self , * args ):
12711280 DEBUG_MSG ("destroy()" , 1 , self )
12721281 self .frame .Destroy ()
1282+ self .canvas .Destroy ()
1283+ #if self.tb is not None: self.tb.Destroy()
12731284 import wx
12741285 #wx.GetApp().ProcessIdle()
12751286 wx .WakeUpIdle ()
0 commit comments