-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
MouseEvent.x and .y have different types #11496
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
Comments
This likely comes from the fact that |
Is there any reason we can't cast to an int before y is returned if it is always integer valued? |
Probably not, but I suppose that theoretically you could get half-pixels on something like a HiDPI screen. But I don't know this for sure, and the docs never really made a commitment either way. |
At least the qt5 backend returns physical pixels here (we perform an explicit conversion in mouseEventCoords, so they should always be possible to return integers (which seems indeed better?). |
(actually all backends currently share the inconsistency of returning x as int and y as float, so removed the tk label) |
Lets cast y to be an int every where. |
I can submit a PR |
Thanks @TarasKuzyo ! Please make sure you get all of the backends |
I was thinking of casting |
It would also be useful to specify the types of |
Fixed by #11530. |
Bug report
Bug summary
MouseEvent.x
is an int butMouseEvent.y
is a float.Code for reproduction
Actual outcome
After randomly clicking on the image:
Expected outcome
Matplotlib version
print(matplotlib.get_backend())
): TkAggThe text was updated successfully, but these errors were encountered: