You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This likely comes from the fact that .x originates in Tk directly, but .y must be inverted (by subtracting from canvas height) to be consistent with the canvas. I'm not sure if this is a bug though; the documentation simply states that they are scalars, which doesn't really commit either way.
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?).
On the other hand, the tk backend doesn't really support retina (#10388), so I'm not sure what's the exact situation there...
I was thinking of casting x and y to int in LocationEvent's constructor, from which MouseEvent inherits. In such a way it will be backend-independent solution.
Activity
QuLogic commentedon Jun 24, 2018
This likely comes from the fact that
.xoriginates in Tk directly, but.ymust be inverted (by subtracting from canvas height) to be consistent with the canvas. I'm not sure if this is a bug though; the documentation simply states that they are scalars, which doesn't really commit either way.dstansby commentedon Jun 25, 2018
Is there any reason we can't cast to an int before y is returned if it is always integer valued?
QuLogic commentedon Jun 25, 2018
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.
anntzer commentedon Jun 25, 2018
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?).
On the other hand, the tk backend doesn't really support retina (#10388), so I'm not sure what's the exact situation there...
anntzer commentedon Jun 26, 2018
(actually all backends currently share the inconsistency of returning x as int and y as float, so removed the tk label)
tacaswell commentedon Jun 26, 2018
Lets cast y to be an int every where.
TarasKuzyo commentedon Jun 27, 2018
I can submit a PR
tacaswell commentedon Jun 27, 2018
Thanks @TarasKuzyo ! Please make sure you get all of the backends
TarasKuzyo commentedon Jun 27, 2018
I was thinking of casting
xandytointinLocationEvent's constructor, from whichMouseEventinherits. In such a way it will be backend-independent solution.tonyxty commentedon Jun 28, 2018
It would also be useful to specify the types of
xandyin the documentation.QuLogic commentedon Jul 1, 2018
Fixed by #11530.