@@ -841,6 +841,8 @@ def onmove(self, event):
841841 'on mouse motion draw the cursor if visible'
842842 if self .ignore (event ):
843843 return
844+ if not self .canvas .widgetlock .available (self ):
845+ return
844846 if event .inaxes != self .ax :
845847 self .linev .set_visible (False )
846848 self .lineh .set_visible (False )
@@ -907,7 +909,8 @@ def __init__(self, canvas, axes, useblit=True, **lineprops):
907909 if useblit :
908910 lineprops ['animated' ] = True
909911
910- self .lines = [ax .axvline (xmid , visible = False , ** lineprops ) for ax in axes ]
912+ self .lines = [ax .axvline (xmid , visible = False , ** lineprops )
913+ for ax in axes ]
911914
912915 self .visible = True
913916 self .useblit = useblit
@@ -921,15 +924,20 @@ def __init__(self, canvas, axes, useblit=True, **lineprops):
921924 def clear (self , event ):
922925 'clear the cursor'
923926 if self .useblit :
924- self .background = self .canvas .copy_from_bbox (self .canvas .figure .bbox )
925- for line in self .lines : line .set_visible (False )
927+ self .background = self .canvas .copy_from_bbox (
928+ self .canvas .figure .bbox )
929+ for line in self .lines :
930+ line .set_visible (False )
926931
927932
928933 def onmove (self , event ):
929- if event .inaxes is None : return
930- if not self .canvas .widgetlock .available (self ): return
934+ if event .inaxes is None :
935+ return
936+ if not self .canvas .widgetlock .available (self ):
937+ return
931938 self .needclear = True
932- if not self .visible : return
939+ if not self .visible :
940+ return
933941
934942 for line in self .lines :
935943 line .set_xdata ((event .xdata , event .xdata ))
0 commit comments