@@ -611,15 +611,13 @@ def set_message(self, s):
611611 self .message .set (s )
612612
613613 def draw_rubberband (self , event , x0 , y0 , x1 , y1 ):
614+ self .remove_rubberband ()
614615 height = self .canvas .figure .bbox .height
615616 y0 = height - y0
616617 y1 = height - y1
617- if hasattr (self , "lastrect" ):
618- self .canvas ._tkcanvas .delete (self .lastrect )
619618 self .lastrect = self .canvas ._tkcanvas .create_rectangle (x0 , y0 , x1 , y1 )
620619
621- def release_zoom (self , event ):
622- super ().release_zoom (event )
620+ def remove_rubberband (self ):
623621 if hasattr (self , "lastrect" ):
624622 self .canvas ._tkcanvas .delete (self .lastrect )
625623 del self .lastrect
@@ -780,11 +778,10 @@ def hidetip(self):
780778
781779class RubberbandTk (backend_tools .RubberbandBase ):
782780 def draw_rubberband (self , x0 , y0 , x1 , y1 ):
781+ self .remove_rubberband ()
783782 height = self .figure .canvas .figure .bbox .height
784783 y0 = height - y0
785784 y1 = height - y1
786- if hasattr (self , "lastrect" ):
787- self .figure .canvas ._tkcanvas .delete (self .lastrect )
788785 self .lastrect = self .figure .canvas ._tkcanvas .create_rectangle (
789786 x0 , y0 , x1 , y1 )
790787
0 commit comments