If the value is not an integer, or sometimes (on what occasions?), is it a float? Because if it would be a string, how you could divide the string by 60? Then I would recreate the code as follows:
I am sure someone that knows tk will know the answer.
But you can find out what the value is by printing its repr in the event handler. You would need to replace the lambda with a function to make that change.
Iâve used the same resource for building Tkinter interfaces in the past. Did you read it thoroughly ?
In the .delta section, it clearly states that event.delta is a multiple of 120 on Windows, and can therefore always be divided by 60. On macOS, event.delta takes smaller values like 1 or 2, and should not be divided by 60. And on Linux, Button-4 and Button-5 should be used instead of the MouseWheel event.
And does that paragraph say, what data type it is? I dont see it. Seeing placeholder â120â doesnt automatically mean, that its an integer data type.
For MouseWheel events, this attribute contains an integer whose sign is positive to scroll up, negative to scroll down
Cristal clear !
But I dont have windows at the moment.
Are you then using another OS ? Or just donât have access to a computer RN ? If youâre using another OS then you donât have to worry about division by 60.
Yes you are right. The point was if this resource is a good resource of inofmation. So if the value is an integer for both Win and MacOS there is no need to change its data type then.
Yes, I am on Linux, but I have to worry If my code is cross platform I need to customize it for other platforms too.