8000 Some small stylistic changes as per comments from BR. · jonovik/matplotlib@135555a · GitHub
[go: up one dir, main page]

Skip to content

Commit 135555a

Browse files
committed
Some small stylistic changes as per comments from BR.
1 parent 05e0d9c commit 135555a

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

examples/event_handling/test_mouseclicks.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
import matplotlib
33
#matplotlib.use("WxAgg")
44
#matplotlib.use("TkAgg")
5-
matplotlib.use("GTKAgg")
5+
#matplotlib.use("GTKAgg")
66
#matplotlib.use("QtAgg")
77
#matplotlib.use("Qt4Agg")
8+
#matplotlib.use("CocoaAgg")
9+
#matplotlib.use("MacOSX")
810
import matplotlib.pyplot as plt
9-
import math
10-
import numpy
1111

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

1414
def OnClick(event):
1515
if event.dblclick:
@@ -25,9 +25,7 @@ def OnRelease(event):
2525
cid_up = fig.canvas.mpl_connect('button_press_event',OnClick)
2626
cid_down = fig.canvas.mpl_connect('button_release_event',OnRelease)
2727

28-
t = numpy.arange(0.0,3.0,0.01)
29-
s = numpy.sin(2*math.pi*t)
30-
plt.plot(t,s)
28+
plt.gca().text(0.5,0.5,"Click on the canvas to test mouse events.",ha="center",va="center")
3129

3230
plt.show()
3331

lib/matplotlib/backends/backend_cocoaagg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def windowDidResize_(self, sender):
166166
self.updatePlot()
167167

168168
def mouseDown_(self, event):
169-
dblclick = True if event.clickCount() == 2 else False
169+
dblclick = (event.clickCount() == 2)
170170
loc = self.convertPoint_fromView_(event.locationInWindow(), None)
171171
type = event.type()
172172
if (type == NSLeftMouseDown):

lib/matplotlib/backends/backend_gtk.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,7 @@ def button_press_event(self, widget, event):
248248
x = event.x
249249
# flipy so y=0 is bottom of canvas
250250
y = self.allocation.height - event.y
251-
if (event.type == gdk._2BUTTON_PRESS): dblclick=True
252-
else: dblclick=False
251+
dblclick = (event.type == gdk._2BUTTON_PRESS)
253252
FigureCanvasBase.button_press_event(self, x, y, event.button, dblclick=dblclick, guiEvent=event)
254253
return False # finish event propagation?
255254

0 commit comments

Comments
 (0)
0