8000 Fix test_mouseclicks.py on Python 3 by cgohlke · Pull Request #979 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Fix test_mouseclicks.py on Python 3 #979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
8000
Diff view
24 changes: 14 additions & 10 deletions examples/event_handling/test_mouseclicks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function

import matplotlib
#matplotlib.use("WxAgg")
#matplotlib.use("TkAgg")
Expand All @@ -9,23 +11,25 @@
#matplotlib.use("MacOSX")
import matplotlib.pyplot as plt

#print "***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****"
#print("***** TESTING WITH BACKEND: %s"%matplotlib.get_backend() + " *****")


def OnClick(event):
if event.dblclick:
print "DBLCLICK",event
else:
print "DOWN ",event
if event.dblclick:
print("DBLCLICK", event)
else:
print("DOWN ", event)


def OnRelease(event):
print "UP ",event
print("UP ", event)


fig = plt.gcf()
cid_up = fig.canvas.mpl_connect('button_press_event',OnClick)
cid_down = fig.canvas.mpl_connect('button_release_event',OnRelease)
cid_up = fig.canvas.mpl_connect('button_press_event', OnClick)
cid_down = fig.canvas.mpl_connect('button_release_event', OnRelease)

plt.gca().text(0.5,0.5,"Click on the canvas to test mouse events.",ha="center",va="center")
plt.gca().text(0.5, 0.5, "Click on the canvas to test mouse events.",
ha="center", va="center")

plt.show()

0