Skip to content

Commit a1eef38

Browse files
authored
Merge pull request #21389 from jatin837/unused-pxl-coord
Log pixel coordinates in event_handling coords_demo example on terminal/console
2 parents df12d8c + 8955d02 commit a1eef38

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/event_handling/coords_demo.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818

1919

2020
def on_move(event):
21-
# get the x and y pixel coords
22-
x, y = event.x, event.y
2321
if event.inaxes:
22+
# get the x and y pixel coords
23+
x, y = event.x, event.y
2424
ax = event.inaxes # the axes instance
25-
print('data coords %f %f' % (event.xdata, event.ydata))
25+
print('data coords %f %f, pixel coords %f %f'
26+
% (event.xdata, event.ydata, x, y))
2627

2728

2829
def on_click(event):

0 commit comments

Comments
 (0)