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
IDLE Show completions pop-up not working on macOS #84309
Comments
Hi, |
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. |
With 3.10.0b2 on my MacBook Air, completions work as far as I tested, with Edit => Show completions, Tab, and ^-Space. i<tab> 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 bpo-44398 for the hotkey issue. |
Thank you for the fix. |
Pablo (and Ned) PR_26672 (and backports) added one line to idlelib/autocomplete_w.py, 206 or 209. This is consistent with https://www.tcl.tk/man/tcl8.6/TclCmd/update.html At the end of the PR, Tal Einat reports 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,
It is obviously too late for 3.9.7. |
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. |
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):
... |
I've created a separate issue for the completion window not appearing on Linux, issue bpo-45193. Let's move the discussion there. |
Thanks Terry, I have cherry-picked commit b441e99 to the 3.10.0 release branch! |
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. |
I cherry-picked #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 |
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 bpo-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. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: