Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c51a33 commit 3ce0e06Copy full SHA for 3ce0e06
1 file changed
examples/event_handling/test_mouseclicks.py
@@ -0,0 +1,33 @@
1
+#!/usr/bin/env python
2
+import matplotlib
3
+#matplotlib.use("WxAgg")
4
+#matplotlib.use("TkAgg")
5
+matplotlib.use("GTKAgg")
6
+#matplotlib.use("QtAgg")
7
+#matplotlib.use("Qt4Agg")
8
+import matplotlib.pyplot as plt
9
+import math
10
+import numpy
11
+
12
+print "***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****"
13
14
+def OnClick(event):
15
+ if event.dblclick:
16
+ print "DBLCLICK",event
17
+ else:
18
+ print "DOWN",event
19
20
+def OnRelease(event):
21
+ print "UP",event
22
23
24
+fig = plt.gcf()
25
+cid_up = fig.canvas.mpl_connect('button_press_event',OnClick)
26
+cid_down = fig.canvas.mpl_connect('button_release_event',OnRelease)
27
28
+t = numpy.arange(0.0,3.0,0.01)
29
+s = numpy.sin(2*math.pi*t)
30
+plt.plot(t,s)
31
32
+plt.show()
33
0 commit comments