classification
Title: tkinter.ttk.Scrollbar.fraction() is inaccurate, or at least inconsistent compared to the non ttk version
Type: behavior Stage: needs patch
Components: Tkinter Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: pez, serhiy.storchaka, terry.reedy
Priority: normal Keywords:

Created on 2018-05-28 10:39 by pez, last changed 2018-06-01 17:12 by terry.reedy.

Files
File name Uploaded Description Edit
ttk_scroll_bug.py pez, 2018-05-28 10:39
Messages (2)
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.
History
Date User Action Args
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