Issue 33665: tkinter.ttk.Scrollbar.fraction() under-estimates length (original) (raw)

Created on 2018-05-28 10:39 by pez, last changed 2022-04-11 14:59 by admin. 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
2022-04-11 14:59:00 admin set github: 77846
2020-07-03 05:31:48 serhiy.storchaka set status: open -> closedresolution: third partymessages: + stage: needs patch -> resolved
2020-07-02 19:10:37 epaine set files: + ttkscrl.tcl
2020-07-02 19:10:32 epaine set files: + ttkscrl.pynosy: + epaineversions: + Python 3.9, Python 3.10, - Python 3.6, Python 3.7messages: + 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:57 terry.reedy set versions: + Python 3.7, Python 3.8nosy: + terry.reedy, serhiy.storchakamessages: + stage: needs patch
2018-05-28 10:39:05 pez create