This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Tkinter scroll issues on macOS
Type: behavior Stage: commit review
Components: Tkinter Versions: Python 3.7, Python 3.6
process
Status: open Resolution: third party
Dependencies: Superseder:
Assigned To: Nosy List: ned.deily, rhettinger, serhiy.storchaka, terry.reedy, vtudorache, wordtech
Priority: normal Keywords:

Created on 2018-08-10 10:07 by vtudorache, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
Tk86MacIssue.mov vtudorache, 2018-08-10 18:28
Tk85Mac.mov vtudorache, 2018-08-10 18:34
Messages (15)
msg323363 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-10 10:07
Run the python script below.

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()

When the slider is at the top of the scrollbar, clicking on its upper half doesn't allow dragging. The little script shows that the Scrollbar considers it as being on "through1" - in Tk the zone between the upper arrow and the "slider" - and not on "slider". Another consequence is that one can drag (up and down) the slider when clicking a little bit below the slider, on "through2" region. This issue doesn't manifest on Windows, where the scrollbar's arrows are shown.
I've seen this issue when trying to explore the reasons of another (34047, fixed) concerning the slider locked at the end of the scrollbar in IDLE.
msg323379 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-10 18:28
The bug needs forwarding to the Tcl/Tk community. This is the script written in Tcl (run with tclsh8.6 script.tcl for Tcl 8.6 and tclsh8.5 script.tcl for 8.5):

package require Tk

scrollbar .vbar -width 10
text .edit

pack .vbar -side right -fill y
pack .edit -side left -fill both -expand 1

.vbar configure -command {.edit yview}
.edit configure -yscrollcommand {.vbar set}

bind .vbar {<Button-1> } {
	set cx %x
	set cy %y
	set dz [.vbar identify $cx $cy]
	puts "You clicked at ($cx,$cy) on $dz.\n"
}

for {set i 1} {$i <= 256} {incr i} {
	.edit insert "$i.0" "This is the line number $i.\n"
}

I will post two videos made on my MacBook, showing an expected behavior with Tk 8.5 and the scroll problems with Tk 8.6 on macOS.
msg323381 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-10 18:34
Now, the video for TK 8.5 showing expected behavior on macOS.
msg323547 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-08-15 02:40
I just committed http://core.tcl.tk/tk/info/26a029b4a88ff97f, which fixes the scrolling issue in Tk. Running the test scripts here indicate the behavior is now correct; clicking several pixels below the bottom part of the scroll button causes the scroll to jump, instead of smoothly scrolling. (One must click the scroll button directly for smooth scrolling, which is the expected behavior.) The fix involved removing support for a small scroll button variant, which was causing the confusion; by sticking with a single variant, the normal size scroller, the behavior is correct and consistent.
msg323558 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-08-15 08:42
It seems that Kevin's fix solves the issues.
msg326515 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-09-27 00:00
New changeset adf493227f1efd5d6b34f46b854142bf3b5a411c by Ned Deily in branch '3.6':
bpo-34370: Update Tk 8.6 used with macOS installers
https://github.com/python/cpython/commit/adf493227f1efd5d6b34f46b854142bf3b5a411c
msg326516 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-09-27 00:12
New changeset d9cfe5ed2c2c61eeae915b76f5e10aadbbb28da6 by Ned Deily in branch '3.7':
bpo-34370: Update Tk 8.6 used with macOS installers
https://github.com/python/cpython/commit/d9cfe5ed2c2c61eeae915b76f5e10aadbbb28da6
msg326517 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-09-27 02:31
FYI, for the python.org binary macOS installers for the 3.7.1rc1 and 3.6.7rc1 releases, I cherry-picked a post-8.6.8 development snapshot of Tk 8.6 that should include Kevin's fix.  I would appreciate any feedback one way or the other whether this version of Tk 8.6 improves things over the vanilla 8.6.8 version used for the 3.7.0 and 3.6.6 releases.  Thanks!
msg326559 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-09-27 13:26
Ned, please hold off a bit on this--another developer is doing some final fine-tuning of the scrolling code so it fully passes Tk's test suite. I'm waiting for the final commit of this code any day now.
msg326654 - (view) Author: Vlad Tudorache (vtudorache) * Date: 2018-09-28 19:18
The scroll problem (clicking on the upper half of the slider is taken as "through1") still persists for me on Mojave with 3.7.1 RC1 downloaded from python.org and including Tcl/Tk.
msg326658 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-09-28 20:52
Thanks for testing, Vlad.  And thanks for the followup, Kevin.  I guess we'll wait to hear more from Kevin.
msg326760 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-10-01 02:33
I just installed 3.7.1rc on current High Sierra and observed same as Vlad.
msg327669 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-10-13 20:39
New changeset f55c3ae657595d12ce78aca76c9c6b998d632424 by Ned Deily in branch '3.6':
bpo-34370: Revert to using released Tk 8.6.8 with macOS installers
https://github.com/python/cpython/commit/f55c3ae657595d12ce78aca76c9c6b998d632424
msg327671 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-10-13 20:46
New changeset d8b6425e58a1fccdf8ddbbcde63066c13c1bcfaf by Ned Deily in branch '3.7':
bpo-34370: Revert to using released Tk 8.6.8 with macOS installers
https://github.com/python/cpython/commit/d8b6425e58a1fccdf8ddbbcde63066c13c1bcfaf
msg327929 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-10-18 02:20
Release of Tk 8.6.9 very soon; includes fixes for Mac scrolling as well as support for 10.14 macOS, with Dark Mode.
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78551
2018-10-18 02:20:51wordtechsetmessages: + msg327929
2018-10-13 20:46:38ned.deilysetmessages: + msg327671
2018-10-13 20:39:49ned.deilysetmessages: + msg327669
2018-10-01 02:33:52terry.reedysetnosy: + terry.reedy
messages: + msg326760
2018-09-28 20:52:47ned.deilysetmessages: + msg326658
2018-09-28 19:18:37vtudorachesetmessages: + msg326654
2018-09-27 13:26:48wordtechsetstatus: pending -> open

messages: + msg326559
2018-09-27 02:31:50ned.deilysetstatus: open -> pending

nosy: + rhettinger
messages: + msg326517

resolution: third party
stage: commit review
2018-09-27 00:12:57ned.deilysetmessages: + msg326516
2018-09-27 00:00:28ned.deilysetnosy: + ned.deily
messages: + msg326515
2018-08-15 08:42:32vtudorachesetmessages: + msg323558
2018-08-15 02:40:53wordtechsetmessages: + msg323547
2018-08-12 23:10:00terry.reedysetnosy: + wordtech, serhiy.storchaka
2018-08-10 18:34:08vtudorachesetfiles: + Tk85Mac.mov

messages: + msg323381
2018-08-10 18:28:28vtudorachesetfiles: + Tk86MacIssue.mov

messages: + msg323379
2018-08-10 10:07:16vtudorachecreate