Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ea590ce

Browse filesBrowse files
committed
Fix test_mouseclicks.py on Python 3
1 parent a720fd7 commit ea590ce
Copy full SHA for ea590ce

File tree

Expand file treeCollapse file tree

1 file changed

+14
-10
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-10
lines changed

‎examples/event_handling/test_mouseclicks.py

Copy file name to clipboardExpand all lines: examples/event_handling/test_mouseclicks.py
+14-10Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/usr/bin/env python
2+
from __future__ import print_function
3+
24
import matplotlib
35
#matplotlib.use("WxAgg")
46
#matplotlib.use("TkAgg")
@@ -9,23 +11,25 @@
911
#matplotlib.use("MacOSX")
1012
import matplotlib.pyplot as plt
1113

12-
#print "***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****"
14+
#print("***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****")
15+
1316

1417
def OnClick(event):
15-
if event.dblclick:
16-
print "DBLCLICK",event
17-
else:
18-
print "DOWN ",event
18+
if event.dblclick:
19+
print("DBLCLICK", event)
20+
else:
21+
print("DOWN ", event)
22+
1923

2024
def OnRelease(event):
21-
print "UP ",event
25+
print("UP ", event)
2226

2327

2428
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)
29+
cid_up = fig.canvas.mpl_connect('button_press_event', OnClick)
30+
cid_down = fig.canvas.mpl_connect('button_release_event', OnRelease)
2731

28-
plt.gca().text(0.5,0.5,"Click on the canvas to test mouse events.",ha="center",va="center")
32+
plt.gca().text(0.5, 0.5, "Click on the canvas to test mouse events.",
33+
ha="center", va="center")
2934

3035
plt.show()
31-

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.