classification
Title: tkinter.ttk.Scrollbar.fraction() under-estimates length
Type: behavior Stage: resolved
Components: Tkinter Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: epaine, pez, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2018-05-28 10:39 by pez, last changed 2020-07-03 05:31 by serhiy.storchaka. This issue is now closed.

Files
File name Uploaded Description Edit
ttk_scroll_bug.py pez, 2018-05-28 10:39
ttkscrl.py epaine, 2020-07-02 19:10
ttkscrl.tcl epaine, 2020-07-02 19:10
Messages (4)
msg317836 - (view) Author: (pez) Date: 2018-05-28 10:39
tkinter.Scrollbar(orient='horizontal').fraction() gives you an accurate representation of how far along the mouse is in the trough. The output is 0.0 when the mouse is on the first pixel of the trough. The output is 1.0 when the mouse is on the last pixel of the trough.

tkinter.ttk.Scrollbar(orient='horizontal').fraction() believes the trough is 16 pixels shorter than it is. The output is 0.0 when the mouse is on the first pixel of the trough. However, the output is greater than 1.0 when the mouse is on the last pixel of the trough. This extra 16 pixels is static, so the behavior is the same regardless of how wide the scrollbar is.

While possibly coincidental, it's interesting that the 16 pixels is also close to the default width of the scrollbar.

This is happening for me on Windows 7.
Did not test vertical orientation.
msg318435 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-01 17:12
Please post the code you used to test this.
msg372874 - (view) Author: E. Paine (epaine) * Date: 2020-07-02 19:10
I agree that the `tkinter.ttk.Scrollbar.fraction` under-estimates the length of the trough and I have written a program to try to measure this precisely.

When tested (only on Linux, granted), this deficit was measured to be 9 pixels (unless I got the maths wrong!). Tcl/Tk gave **exactly** the same numbers when run using 'wish'.

Thank you pez for reporting this, but 2 years on it should be closed as third party (please do take it up with the tcl team if you feel it is a real issue).
msg372906 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-07-03 05:31
Thank you for testing it E. Paine. I agree that it is not a Tkinter issue.
History
Date User Action Args
2020-07-03 05:31:48serhiy.storchakasetstatus: open -> closed
resolution: third party
messages: + msg372906

stage: needs patch -> resolved
2020-07-02 19:10:37epainesetfiles: + ttkscrl.tcl
2020-07-02 19:10:32epainesetfiles: + ttkscrl.py

nosy: + epaine
versions: + Python 3.9, Python 3.10, - Python 3.6, Python 3.7
messages: + msg372874

title: tkinter.ttk.Scrollbar.fraction() is inaccurate, or at least inconsistent compared to the non ttk version -> tkinter.ttk.Scrollbar.fraction() under-estimates length
2018-06-01 17:12:57terry.reedysetversions: + Python 3.7, Python 3.8
nosy: + terry.reedy, serhiy.storchaka

messages: + msg318435

stage: needs patch
2018-05-28 10:39:05pezcreate