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

Sign up
Appearance settings

Commit a1eef38

Browse files
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

Lines changed: 4 additions & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /