Skip to content

Tkinter scroll issues on macOSΒ #78551

Open

Description

@vtudorache
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']

    Activity

    1. vtudorache commented on Aug 10, 2018

      vtudorachemannequin
      MannequinAuthor

      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.

    2. vtudorache commented on Aug 10, 2018

      vtudorachemannequin
      MannequinAuthor

      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.

    3. vtudorache commented on Aug 10, 2018

      vtudorachemannequin
      MannequinAuthor

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

    4. wordtech commented on Aug 15, 2018

      wordtechmannequin
      Mannequin

      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.

    5. vtudorache commented on Aug 15, 2018

      vtudorachemannequin
      MannequinAuthor

      It seems that Kevin's fix solves the issues.

    6. ned-deily commented on Sep 27, 2018

      @ned-deily
      Member

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

    7. ned-deily commented on Sep 27, 2018

      @ned-deily
      Member

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

    8. ned-deily commented on Sep 27, 2018

      @ned-deily
      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!

    9. wordtech commented on Sep 27, 2018

      wordtechmannequin
      Mannequin

      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.

    10. vtudorache commented on Sep 28, 2018

      vtudorachemannequin
      MannequinAuthor

      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.

    11. ned-deily commented on Sep 28, 2018

      @ned-deily
      Member

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

    12. terryjreedy commented on Oct 1, 2018

      @terryjreedy
      Member

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

    13. ned-deily commented on Oct 13, 2018

      @ned-deily
      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

    14. ned-deily commented on Oct 13, 2018

      @ned-deily
      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

    15. wordtech commented on Oct 18, 2018

      wordtechmannequin
      Mannequin

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

    16. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions