classification
Title: Tkinter scrollbar issues on Mac.
Type: behavior Stage: resolved
Components: macOS, Tkinter Versions: Python 3.9, Python 3.8, Python 3.7
process
Status: closed Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: chrstphrchvz, ned.deily, serhiy.storchaka, terry.reedy, wordtech
Priority: normal Keywords:

Created on 2018-09-25 00:08 by terry.reedy, last changed 2019-06-16 20:14 by terry.reedy. This issue is now closed.

Messages (10)
msg326299 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-09-25 00:08
#34047 was about scrollbar issues on MacOS in 3.7.0 and 3.6.6.  One was due to an IDLE bug, which was fixed on the issue.  Others, which can be demonstrated in the pure tkinter code below, are the subject of this issue.

1. Slider does not move properly when at top or bottom.
2. Clicking trough near slider at top or bottom has no effect.
See #34047 for more discussions and details.

Vlad Tudorache posted the code below as msg323349 of #34047 and attached as tktest.py, along with tkinter_scroll_issues.mov.
---

import tkinter

root = tkinter.Tk()

text = tkinter.Text(root)
vbar = tkinter.Scrollbar(root)

vbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
text.pack(side=tkinter.LEFT, fill=tkinter.BOTH, expand=1)

text.config(yscrollcommand=vbar.set)
vbar.config(command=text.yview)

lines = ['This is the line number %d.\n' % i for i in range(256)]
text.insert(tkinter.END, ''.join(lines))
 
def click_trace(event):
    text.insert('%d.%d' % (1, 0), 'Clicked at (%d,%d) on %s.\n' % (event.x, event.y, vbar.identify(event.x, event.y)))

vbar.bind('<Button-1>', click_trace)

root.mainloop()
---

"Clicking at the top on the slider shows that the Scrollbar considers it as being on "through1" (in Tk the zone between the upper arrow and the "slider") and NOT on the "slider". Please, play with the script (python3 tktest.py) and see the results for yourselves."
msg345757 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-16 14:55
Ned, is the version of tcl/tk on Mac the same in 3.8.0b1 and upcoming 3.7.4 as it was last September?  (8.6.8 in 3.7.3, not sure in Sept.)
msg345764 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-16 18:42
As far as I recall, we have only ever shipped 8.6.8 in final releases since we started providing a built-in Tcl/Tk in the python.org macOS installers as of 3.7.0, 3.6.8, and 2.7.16 (https://www.python.org/download/mac/tcltk/).  There was the disastrous attempt to update to 8.6.9+ during the 3.7.2rc phase which we ultimately reverted prior to 3.7.2 final, as documented in Issue35485.  Since then, there do not seem to have been any official releases of 8.6.9 so we remain with 8.6.8.  It would probably be a good thing for someone to work with the Tk folks on seeing whether the problems seen are being resolved but it's not something I expect to have time for in the foreseeable future.
msg345765 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-16 18:46
> Since then, there do not seem to have been any official releases of 8.6.9 so we remain with 8.6.8

That is: there have been no official releases of Tk past 8.6.9.1 which was tried, along with the then current HEAD of the 8.6 maintenance branch, back in December.
msg345767 - (view) Author: Christopher A. Chavez (chrstphrchvz) Date: 2019-06-16 19:14
I have not successfully reproduced the issue here with tkinter 3.7.3 using 8.6.9.1 or recent core-8-6-branch on macOS Mojave.

I understand the reporter of this issue believed this was not an upstream Tk issue. However there's a recently opened upstream ticket relating to scrollbars on Aqua which may be of interest: 
https://core.tcl-lang.org/tk/info/8476b757811b3694

At the moment, one of the Tk Aqua developers appears to advise against using the normal (non-Ttk) scrollbar at all on macOS because it has never worked properly and likely will not be fixed, and instead suggests using the new Ttk scrollbar implementation, which should be available in 8.6.10.
msg345768 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2019-06-16 19:20
As far as I recall, the scrollbar issue did seem to be fixed in 8.6.9.1 so that was one plus for updating.  But, as described in Issue35485, updating introduced other, far more serious new problems so we decided to revert to 8.6.8 and wait for a new official release.
msg345769 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-16 19:21
This should probably be closed as 3rd party, but someone needs to verify that the bug is in tk.  In the meanwhile, let it sit.

Vlad's test works perfectly on Windows with 8.6.9.  In multiple tries, mouse at (x, Y <= 16) is top arrow, (x, y >= 17) is slider.
msg345771 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-16 19:34
Christopher, I submitted before seeing your message.  Thank you for the additional info, which verifies that this is an upstream issue.  Apparently, the current ttk.Scrollbar on the 8.6.8 we currently deliver should sort of work.
msg345773 - (view) Author: Christopher A. Chavez (chrstphrchvz) Date: 2019-06-16 19:45
> Apparently, the current ttk.Scrollbar on the 8.6.8 we currently deliver should sort of work.

I'm not sure if that is the case, though I have not tested with 8.6.8 (I do not currently have access to High Sierra or earlier). Based on a comment by the developer (Marc Culler) in https://core.tcl-lang.org/tk/tktview?name=0d63621b6c it sounds like the Ttk scrollbar is a completely new implementation for 8.6.10, whereas before (8.6.9.1? 8.6.8?) any code requesting a Ttk scrollbar on Aqua normally got a non-Ttk scrollbar instead.
msg345774 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-06-16 20:14
IDLE currently uses whatever 'ttk.Scrollbar' is. Unlike Windows, there are no top and bottom arrows, but this is also true with Safari, so I presume normal.

"Clicking trough near slider has no effect".  True for large file and small slider, not for medium file with large slider.

"Clicking top of slider treated as clicking on trough above slider.  True for about top 2 mm of the slider, when click and hold does not grab the slider.  If the slider is not at the top, it moves up.

So ttk slider becomes less useful as the file gets large, and only half usable at about 3000 lines and up.
History
Date User Action Args
2019-06-16 20:14:13terry.reedysetmessages: + msg345774
2019-06-16 19:45:42chrstphrchvzsetmessages: + msg345773
2019-06-16 19:34:17terry.reedysetstatus: open -> closed
versions: + Python 3.7, Python 3.8
messages: + msg345771

resolution: third party
stage: test needed -> resolved
2019-06-16 19:21:51terry.reedysetversions: + Python 3.9, - Python 3.6, Python 3.7, Python 3.8
nosy: - ronaldoussoren

messages: + msg345769

stage: needs patch -> test needed
2019-06-16 19:20:38ned.deilysetmessages: + msg345768
2019-06-16 19:14:44chrstphrchvzsetmessages: + msg345767
2019-06-16 18:46:14ned.deilysetmessages: + msg345765
2019-06-16 18:42:03ned.deilysetmessages: + msg345764
2019-06-16 14:55:17terry.reedysetmessages: + msg345757
2019-06-16 09:36:41chrstphrchvzsetnosy: + chrstphrchvz
2018-09-25 00:10:13terry.reedylinkissue34047 superseder
2018-09-25 00:08:44terry.reedycreate