Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e474977

Browse files
committed
Added a test_disconnect command line parameter for testing mpl_disconnect.
svn path=/trunk/matplotlib/; revision=728
1 parent e38f699 commit e474977

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

examples/coords_demo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
An example of how to interact with the plotting canvas by connecting
44
to move and click events
55
"""
6+
import sys
67
from matplotlib.matlab import *
78

89
t = arange(0.0, 1.0, 0.01)
@@ -27,9 +28,11 @@ def on_click(event):
2728
if event.inaxes is not None:
2829
print 'data coords', event.xdata, event.ydata
2930

30-
canvas.mpl_connect('motion_notify_event', on_move)
31+
binding_id = canvas.mpl_connect('motion_notify_event', on_move)
3132
#canvas.mpl_connect('button_press_event', on_click)
3233

33-
34+
if "test_disconnect" in sys.argv:
35+
print "disconnecting console coordinate printout..."
36+
canvas.mpl_disconnect(binding_id)
3437

3538
show()

0 commit comments

Comments
 (0)