Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tkinter scroll issues on macOS #78551

Open
vtudorache mannequin opened this issue Aug 10, 2018 · 15 comments
Open

Tkinter scroll issues on macOS #78551

vtudorache mannequin opened this issue Aug 10, 2018 · 15 comments
Labels
3.7 (EOL) end of life topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@vtudorache
Copy link
Mannequin

vtudorache mannequin commented Aug 10, 2018

BPO 34370
Nosy @rhettinger, @terryjreedy, @ned-deily, @serhiy-storchaka
Files
  • Tk86MacIssue.mov
  • Tk85Mac.mov
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2018-08-10.10:07:16.876>
    labels = ['3.7', 'type-bug', 'expert-tkinter']
    title = 'Tkinter scroll issues on macOS'
    updated_at = <Date 2018-10-18.02:20:51.508>
    user = 'https://bugs.python.org/vtudorache'

    bugs.python.org fields:

    activity = <Date 2018-10-18.02:20:51.508>
    actor = 'wordtech'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tkinter']
    creation = <Date 2018-08-10.10:07:16.876>
    creator = 'vtudorache'
    dependencies = []
    files = ['47742', '47743']
    hgrepos = []
    issue_num = 34370
    keywords = []
    message_count = 15.0
    messages = ['323363', '323379', '323381', '323547', '323558', '326515', '326516', '326517', '326559', '326654', '326658', '326760', '327669', '327671', '327929']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'terry.reedy', 'wordtech', 'ned.deily', 'serhiy.storchaka', 'vtudorache']
    pr_nums = []
    priority = 'normal'
    resolution = 'third party'
    stage = 'commit review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34370'
    versions = ['Python 3.6', 'Python 3.7']

    @vtudorache
    Copy link
    Mannequin Author

    vtudorache mannequin commented Aug 10, 2018

    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.

    @vtudorache vtudorache mannequin added 3.7 (EOL) end of life topic-tkinter type-bug An unexpected behavior, bug, or error labels Aug 10, 2018
    @vtudorache
    Copy link
    Mannequin Author

    vtudorache mannequin commented Aug 10, 2018

    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.

    @vtudorache
    Copy link
    Mannequin Author

    vtudorache mannequin commented Aug 10, 2018

    Now, the video for TK 8.5 showing expected behavior on macOS.

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Aug 15, 2018

    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.

    @vtudorache
    Copy link
    Mannequin Author

    vtudorache mannequin commented Aug 15, 2018

    It seems that Kevin's fix solves the issues.

    @ned-deily
    Copy link
    Member

    New changeset adf4932 by Ned Deily in branch '3.6':
    bpo-34370: Update Tk 8.6 used with macOS installers
    adf4932

    @ned-deily
    Copy link
    Member

    New changeset d9cfe5e by Ned Deily in branch '3.7':
    bpo-34370: Update Tk 8.6 used with macOS installers
    d9cfe5e

    @ned-deily
    Copy link
    Member

    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!

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Sep 27, 2018

    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.

    @vtudorache
    Copy link
    Mannequin Author

    vtudorache mannequin commented Sep 28, 2018

    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.

    @ned-deily
    Copy link
    Member

    Thanks for testing, Vlad. And thanks for the followup, Kevin. I guess we'll wait to hear more from Kevin.

    @terryjreedy
    Copy link
    Member

    I just installed 3.7.1rc on current High Sierra and observed same as Vlad.

    @ned-deily
    Copy link
    Member

    New changeset f55c3ae by Ned Deily in branch '3.6':
    bpo-34370: Revert to using released Tk 8.6.8 with macOS installers
    f55c3ae

    @ned-deily
    Copy link
    Member

    New changeset d8b6425 by Ned Deily in branch '3.7':
    bpo-34370: Revert to using released Tk 8.6.8 with macOS installers
    d8b6425

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Oct 18, 2018

    Release of Tk 8.6.9 very soon; includes fixes for Mac scrolling as well as support for 10.14 macOS, with Dark Mode.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life topic-tkinter type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants