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 scrollbar issues on Mac. #78977

Closed
terryjreedy opened this issue Sep 25, 2018 · 10 comments
Closed

Tkinter scrollbar issues on Mac. #78977

terryjreedy opened this issue Sep 25, 2018 · 10 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes OS-mac topic-tkinter type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 34796
Nosy @terryjreedy, @ned-deily, @serhiy-storchaka, @chrstphrchvz

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 = <Date 2019-06-16.19:34:17.094>
created_at = <Date 2018-09-25.00:08:44.495>
labels = ['OS-mac', 'type-bug', 'expert-tkinter', '3.9', '3.8', '3.7']
title = 'Tkinter scrollbar issues on Mac.'
updated_at = <Date 2019-06-16.20:14:13.888>
user = 'https://github.com/terryjreedy'

bugs.python.org fields:

activity = <Date 2019-06-16.20:14:13.888>
actor = 'terry.reedy'
assignee = 'none'
closed = True
closed_date = <Date 2019-06-16.19:34:17.094>
closer = 'terry.reedy'
components = ['macOS', 'Tkinter']
creation = <Date 2018-09-25.00:08:44.495>
creator = 'terry.reedy'
dependencies = []
files = []
hgrepos = []
issue_num = 34796
keywords = []
message_count = 10.0
messages = ['326299', '345757', '345764', '345765', '345767', '345768', '345769', '345771', '345773', '345774']
nosy_count = 5.0
nosy_names = ['terry.reedy', 'wordtech', 'ned.deily', 'serhiy.storchaka', 'chrstphrchvz']
pr_nums = []
priority = 'normal'
resolution = 'third party'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue34796'
versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

@terryjreedy
Copy link
Member Author

bpo-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 bpo-34047 for more discussions and details.

Vlad Tudorache posted the code below as msg323349 of bpo-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."

@terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes OS-mac topic-tkinter type-bug An unexpected behavior, bug, or error labels Sep 25, 2018
@terryjreedy
Copy link
Member Author

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

@ned-deily
Copy link
Member

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 bpo-35485. 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.

@ned-deily
Copy link
Member

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.

@chrstphrchvz
Copy link
Mannequin

chrstphrchvz mannequin commented Jun 16, 2019

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.

@ned-deily
Copy link
Member

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 bpo-35485, updating introduced other, far more serious new problems so we decided to revert to 8.6.8 and wait for a new official release.

@terryjreedy
Copy link
Member Author

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.

@terryjreedy terryjreedy added 3.9 only security fixes and removed 3.7 (EOL) end of life 3.8 only security fixes labels Jun 16, 2019
@terryjreedy
Copy link
Member Author

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.

@terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes labels Jun 16, 2019
@chrstphrchvz
Copy link
Mannequin

chrstphrchvz mannequin commented Jun 16, 2019

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.

@terryjreedy
Copy link
Member Author

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.

@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 3.8 only security fixes 3.9 only security fixes OS-mac topic-tkinter type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants