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 f6e0ee4

Browse filesBrowse 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 9fb5370 + f96c73c commit f6e0ee4
Copy full SHA for f6e0ee4

File tree

Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-3
lines changed
Open diff view settings
Collapse file

‎examples/event_handling/coords_demo.py‎

Copy file name to clipboardExpand all lines: examples/event_handling/coords_demo.py
+4-3Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.