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: IDLE Show completions pop-up not working on macOS
Type: behavior Stage: resolved
Components: IDLE, macOS Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: darthur90, lukasz.langa, miss-islington, ned.deily, pablogsal, ronaldoussoren, taleinat, terry.reedy, thsubaku9
Priority: normal Keywords: patch

Created on 2020-03-31 17:16 by darthur90, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 26672 merged thsubaku9, 2021-06-11 19:39
PR 26683 merged miss-islington, 2021-06-11 22:55
PR 26684 merged miss-islington, 2021-06-11 22:56
Messages (16)
msg365401 - (view) Author: Arthur (darthur90) Date: 2020-03-31 17:16
Hi,
I am new to python, I am learning it now. In the course the guy is using autocomplete and when he writes "math." he gets an autocomplete menu. on my device for some reason it is not working. I also tried the key combination to force pop-up but nothing happens.
I am running macOSx Catalina 10.15.2 and IDLE 3.8.2 
P.s. I reinstalled IDLE, nothing changed.
msg365447 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-04-01 03:20
My first though was that the 'guy' had executed 'import math' and you had not.  (See the IDLE doc at https://docs.python.org/3/library/idle.html or, within IDLE, Help => IDLE Help, "Editing and navigations" section, "completions' subsection, 2nd to last paragraph.)  Or maybe this was another 'Catalina' issue.

But I tried completion on my MacbookAir with Mohave 10.14.6? and 3.8.2 and 3.7.5, in Shell at >>>, that don't need imports. 'i'<tab> should bring up a box with 'id' at the top.  'int.' should bring up a box with 'as_integer_ratio' at the top.  This works for me on Windows but not on the Mac.

For shortcuts, IDLE Preferences, Keys tab, has "force_open_completions    <control-key-space>".  But the edit menu has "Show completions     ^S". Control-S is not Control-space.  Bug 1. In either case, neither work.  Nor does clicking the menu entry.  Bug 2.  Hitting ^S causes "Edit" on the main menu to flash blue (Mac only); ^space.  I believe this means that ^S invoked an item on the menu.  I repeated the above with IDLE started in Terminal ('python3 -m idlelib').  No errors messages appeared.

There are issues where shortcuts don't work, because they duplicate system binding, but menu items do.  This is different.

Is this a tkinter widget problem?  Similar Toplevel popups (calltips, squeezer tooltips) work.  Listbox is also used in config, config-key, and debugger dialogs, all of which at least appear.  

A debug print is autocomplete_w.py show_window reveals that it is called when it should be, including after both ^space and ^S, with what I believe are appropriate arguments.  Another print in winconfig_event, just before the geometry call to move the window into view, shows that x,y position looks good.  But two oddities: winconfig_event is called twice instead of once, and with ^space and not ^S.  I have no idea how this could be.  Adding update() just before update_idletasks() prevents the 2nd winconfig_event call but does not make the popup appear.

I am out of ideas at the moment, except for this.  Other popups are withdrawn while created and filled in, and then deiconified, while this one is moved off screen to 10000,10000 and moved back. Wondering whether tk 8.6 does not like this movement, I disabled it.  The widget should then appear, but does not.
msg395657 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-11 19:37
With 3.10.0b2 on my MacBook Air, completions work as far as I tested, with Edit => Show completions, Tab, and ^-Space.

i<tab>
i<^-Space>
int.(configered pause)
int.<^-Space, after dismissing box with Esc key>

3.9.5, without the patch, remains buggy.  I attribute the difference to using tcl/tk 8.6.11 in 3.10 versus 8.6.8 in 3.9 (and 3.8 and worse previously).

3.9.5, with the patch, the above work.  I will apply the patch in main and then backport because other Mac installers may have not switched to 8.6.11, I am not sure it never helps with 8.6.11, I prefer to keep active versions in sync, and it should not hurt except for a micro slowdown.

I opened #44398 for the hotkey issue.
msg395667 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-11 22:55
New changeset 3ec3ee7d2e9b45b586e486e429b412d6d0ca530f by Kaustubh J in branch 'main':
bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
https://github.com/python/cpython/commit/3ec3ee7d2e9b45b586e486e429b412d6d0ca530f
msg395668 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-11 23:24
New changeset b441e99d89a3f05210cc36ade57699384986ca00 by Miss Islington (bot) in branch '3.10':
bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
https://github.com/python/cpython/commit/b441e99d89a3f05210cc36ade57699384986ca00
msg395669 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-11 23:24
New changeset a9e20cf7bbf3ba39260fca112938f95e4f317efc by Miss Islington (bot) in branch '3.9':
bpo-40128: Fix IDLE autocomplete on macOS (GH-26672)
https://github.com/python/cpython/commit/a9e20cf7bbf3ba39260fca112938f95e4f317efc
msg395670 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-11 23:26
Thank you for the fix.
msg401744 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-09-14 00:21
Pablo (and Ned) 

PR_26672 (and backports) added one line to idlelib/autocomplete_w.py, 206 or 209.
  acw.update_idletasks() # Need for tk8.6.8 on macOS: #40128.
NEWs item included "The added update_idletask call should be harmless and possibly helpful otherwise. "

This is consistent with https://www.tcl.tk/man/tcl8.6/TclCmd/update.html

At the end of the PR, Tal Einat reports
"this broke completions for me with Tcl/Tk 8.6.11 on Ubuntu 20.04.
Apparently also with Tcl/Tk 8.6.10, which is the current default.
Also broken in my latest install of Python 3.9.7 (not built from source)."

Tal, did you verify that #ing the line fixes your issues?  Can you be more specific as to what you see?

I rechecked on my Macbook and the line is definitely needed for 3.9.7 with tk 8.6.8.  It makes no difference for 3.10.0rc2 with 8.6.11.  (So the bug of requiring update_idletasks call to ever see the dropdown box was fixed.)

Assume Tal's report is verified on another machine, we could, before 3.10.0,
1. Remove the line.
2. Disable the line.
3. Make it conditional on macOS and 8.6.8.

It is obviously too late for 3.9.7.
msg401745 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-09-14 00:23
https://www.tcl.tk/man/tcl8.6/TclCmd/update.html
msg401756 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2021-09-14 06:19
Confirmed with python 3.9.7 installed via the "deadsnakes" apt repo on another Ubuntu 20.04 machine.

"Confirmed" meaning specifically that the completion window never appears, and commenting out that single line resolves the issue.
msg401757 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2021-09-14 06:25
Note that _tkinter.TK_VERSION and _tkinter.TK_VERSION are simply "8.6", not enough to differentiate between patch versions. The best way to get this info appears to be tk.call("info", "patchlevel").

Specifically I suggest:

TK_VERSION = tuple(map(int, tk.call("info", "patchlevel").split(".")))

...

if (8, 6, 8) <= TK_VERSION < (8, 6, 10):
    ...
msg401759 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2021-09-14 06:30
I've created a separate issue for the completion window not appearing on Linux, issue #45193. Let's move the discussion there.
msg401792 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-14 19:10
Thanks Terry,

I have cherry-picked commit b441e99d89a3f05210cc36ade57699384986ca00 to the 3.10.0 release branch!
msg401795 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2021-09-14 19:46
Pablo, I'm not sure what you cherry-picked, but this fix for macOS broke the completions pop-up on Linux, and that appears to still be the state of things now on the 3.10.0 branch. Let's please not leave things this way if at all possible.
msg401797 - (view) Author: Pablo Galindo Salgado (pablogsal) * (Python committer) Date: 2021-09-14 19:57
> Pablo, I'm not sure what you cherry-picked,

I cherry-picked https://github.com/python/cpython/pull/26684

but this can be easily undone as this is cherry-picked to the 3.10.0 release branch that I have much more control upon.

What would you prefer me to do: undo the cherry-picking or wait for https://github.com/python/cpython/pull/28328/files ?

Notice that this would need to be done ASAP if you want it to be in 3.10.0, otherwise will have to wait until 3.10.1
msg401804 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-09-14 23:09
Pablo, sorry I was not clear. PR_26684 and the line it added, having been merged last June, are already in the 3.10.0rc2 release.  What I want to do immediately is disable the line with a '#'.  I just posted an explanation on #34193.  I am about to make a new PR to do so, and once it is merged and backported to 3.10 (but not 3.9), I will ask you to cherrypick it into the release branch.
History
Date User Action Args
2022-04-11 14:59:28adminsetgithub: 84309
2021-09-14 23:09:22terry.reedysetpriority: release blocker -> normal

messages: + msg401804
2021-09-14 19:57:16pablogsalsetmessages: + msg401797
2021-09-14 19:46:09taleinatsetmessages: + msg401795
2021-09-14 19:10:38pablogsalsetmessages: + msg401792
2021-09-14 06:30:19taleinatsetmessages: + msg401759
2021-09-14 06:25:49taleinatsetmessages: + msg401757
2021-09-14 06:19:40taleinatsetmessages: + msg401756
2021-09-14 00:23:05terry.reedysetmessages: + msg401745
2021-09-14 00:21:13terry.reedysetpriority: normal -> release blocker
nosy: + pablogsal, lukasz.langa
messages: + msg401744

2021-06-11 23:26:00terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg395670

stage: patch review -> resolved
2021-06-11 23:24:43terry.reedysetmessages: + msg395669
2021-06-11 23:24:24terry.reedysetmessages: + msg395668
2021-06-11 22:56:27miss-islingtonsetpull_requests: + pull_request25272
2021-06-11 22:55:44miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request25271
2021-06-11 22:55:39terry.reedysetmessages: + msg395667
2021-06-11 19:39:08thsubaku9setkeywords: + patch
nosy: + thsubaku9
pull_requests: + pull_request25267
2021-06-11 19:37:22terry.reedysetstage: patch review
messages: + msg395657
versions: + Python 3.10, Python 3.11, - Python 3.7, Python 3.8
2020-04-01 03:20:16terry.reedysettitle: IDLE Show completions/ autocomplete pop-up not working -> IDLE Show completions pop-up not working on macOS
nosy: + ned.deily, taleinat, ronaldoussoren

messages: + msg365447

versions: + Python 3.7, Python 3.9
components: + macOS
2020-03-31 17:16:48darthur90create