classification
Title: IDLE Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18
Type: behavior Stage: resolved
Components: IDLE, macOS, Tkinter Versions: Python 3.6, Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Alessandro Rosa, jmas, markroseman, ned.deily, python-dev, ronaldoussoren, taleinat, terry.reedy, wordtech
Priority: normal Keywords: patch

Created on 2015-07-05 20:48 by Alessandro Rosa, last changed 2015-10-26 15:53 by jmas. This issue is now closed.

Files
File name Uploaded Description Edit
calltip.patch markroseman, 2015-08-13 15:15 review
Messages (16)
msg246337 - (view) Author: Alessandro Rosa (Alessandro Rosa) Date: 2015-07-05 20:48
I recently upgraded to Python 2.7.10 on my MacOSX Yosemite computer. I also added a Python 3.4.3 installation. At the time I upgraded Tcl/Tk with ActiveTcl 8.5.18 as was suggested on the Python for MacOSX installation page.

At this point, Autocomplete and Call Tips stopped popping up. I checked the preferences and it seemed to be turned on. The delay was set to 2000, so I changed that to 2, but nothing happened. Pressing <ctrl>-Spacebar and then using the down arrow key lets me cycle through the the available functions, but putting a dot after an object has no effect, and if I open parentheses, I get no tips. This is both in the IDLE Shell and Editor windows.

I tried to redo everything by deleting all instances of Python from my drive. I reinstalled them, reloaded all packages, and Autocomplete and call tips still are not popping up. Is there any known issues or is there a workaround? Do I possibly need to add or change the new Tk path somewhere so that IDLE can find what it needs to popup autocomplete? Is there a way that I can initiate IDLE Autocomplete and Call Tips during the coding session to manually get them to work?

I am somewhat new to Python, and I often rely on the autocomplete tips to remind me of what I need to do or what methods are available for an object. I really like IDLE but it is hard for me to use without this functionality. Any help would be greatly appreciated.

Thank you,
msg246341 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-07-05 21:47
Thanks for the report.  Taking a quick look at it, it appears that the problem was introduced with the most recently releases of ActiveTcl on OS X, 8.5.18 and 8.6.4.  The autocomplete popups seem to work fine with the previous OS X release of ActiveTcl 8.5 (8.5.17) and with a MacPorts +quartz build of Tcl/Tk 8.6.3.  I know that Kevin Walzer added a lot of fixes to the native OS X version of Tk that were first released with 8.6.4 and 8.5.18 and I think there have been additional fixes since then but are not yet in an official Tcl/Tk release.  I'm cc-ing Kevin here; perhaps this will look familiar.

As workarounds, if you have access to ActiveTcl 8.5.17, you could install that.  Or, if you feel up to building your own framework version of 8.5.17, you could try that.  You *could* also remove 8.5.18 and fall back to the Apple-supplied system Tcl/Tk 8.5.9 but I would strongly recommend not doing that as that version has critical problems, most notably the bug that causes Tk to crash (and, thus, crash IDLE with no opportunity for saving work) by typing multi-character compose codes in text boxes (like option-u on US keyboard layouts).

So it should first be established whether this problem still exists with current trunk of 8.5.x (for that's what the OS X installers link with) and, if so, try to get a new version of ActiveTcl 8.5.x released.  It might help to file an issue with ActiveState (https://bugs.activestate.com/index.cgi) and/or on the Tk issue tracker (https://core.tcl.tk/tk/reportlist).  And it would be even better to have a pure Tcl/Tk test case using wish so that Python is not a factor.  Unfortunately, I'm not going to have much time for the immediate future to shepherd that activity.
msg246345 - (view) Author: Kevin Walzer (wordtech) * Date: 2015-07-06 02:27
Where in the IDLE source code tree is this code housed? Is it possible to provide a Python script that reproduces the issue?
msg246348 - (view) Author: Alessandro Rosa (Alessandro Rosa) Date: 2015-07-06 05:31
Thank you for the reply. I raised a bug with ActiveState. I am a Community User, so I can't access prior builds of ActiveTcl, and I am no where near competent enough to build up a framework.
msg246376 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-07-06 18:46
Kevin, I think that Autocomplete is implemented as an IDLE extension in:
Lib/idlelib/AutoComplete.py
Lib/idlelib/AutoCompleteWindow.py

and configured in:
Lib/idlelib/config-extensions.def
-> force-open-completions=<Control-Key-space>

Perhaps someone could try to reduce it to smaller test case; I will likely not have time to work on it myself for the immediate future.  Tal, can you reproduce this issue when using ActiveTcl 8.5.18?
msg246589 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-07-11 00:45
More tests might help pin down the bug. Here is the complete config for completions.
[AutoComplete]
enable=True
popupwait=2000
[AutoComplete_cfgBindings]
force-open-completions=<Control-Key-space>
[AutoComplete_bindings]
autocomplete=<Key-Tab>
try-open-completions=<KeyRelease-period> <KeyRelease-slash> <KeyRelease-backslash>

Notes: config-extensions.def is initially opened and generically processed in various methods of configHandler.IdleConf, and on request, the config-extentions section of EditorWindow.py. cfgBindings can be (sensibly) reconfigured, the others not. Names that follow, before '=', become pseudoevents handles by methods in the

Alessandro, you said <Control-Key-space> works, <KeyRelease-period> does not.  How about <Key-Tab> and <KeyRelease-(back)slash>. The latter pair work within path strings when the preceding chars begin a path that exist on your system.  For instance, on Win 7, './ lists options in the current directory.

I have no idea why KeyRelease instead of Key is used above and below.  There is no key equivalent of releasing a mouse button in a different location than where pressed. Kevin, could there be a bug with KeyRelease on Mac?  Alessandro, you could test by making a backup of configextensions.def and removing 'Release' for 'period'.

The calltip files are
CallTips.py
CallTipWindow.py
and in config-extensions.def,

[CallTips]
enable=True
[CallTips_cfgBindings]
force-open-calltip=<Control-Key-backslash>
[CallTips_bindings]
try-open-calltip=<KeyRelease-parenleft>
refresh-calltip=<KeyRelease-parenright> <KeyRelease-0>

Alessandro, you said <KeyRelease-parenleft> does not work.  How abut <Control-Key-backslash> (after '(') to open?  Does <KeyRelease-parenright> close properly?

I do not know what <KeyRelease-0> (zero) is about.  It does not work for me.

For both boxes, clicking on the box should also close. Does it?
What about Edit -> Show Completions and Edit -> Show calltips for opening?
msg246713 - (view) Author: Alessandro Rosa (Alessandro Rosa) Date: 2015-07-14 03:50
Hi Terry,

I will try my best to answer your questions.

To update you, I decided to completely uninstall the ActiveState frameworks from my Mac. This brought me back to the dreaded Apple version of Tcl/Tk 8.5.9 with the IDLE warning about it. At this point Autocomplete and Call Tips worked again. If I initialized a list and then typed a_list. then the pop up menu would appear for the methods associated with list. If I typed a_list.append( then the Call Tip with the docstring information for list.append would appear. (I didn't try some of the other methods that we talk about in the questions as I was not aware of them at the time).

I then downloaded a new installer from ActiveState for Tcl/Tk 8.5.18 and ran the install. I tested IDLE again, and at this point the Autocomplete pop up menu does not display, and the Call Tips no longer appear when I open a methods parenthesis.

Questions:
======================
"Alessandro, you said <Control-Key-space> works, <KeyRelease-period> does not.  How about <Key-Tab> and <KeyRelease-(back)slash>. The latter pair work within path strings when the preceding chars begin a path that exist on your system."

- <Control-Key-space>
If I type a_list. and then <Control-Key-space> no pop up menu appears, however when I press the Up or Down arrow keys, it cycles through the methods available for that object. The Autocompletes display inline, one at a time and not as a popup.

To expand on this, if I press <Control-Key-space> at the prompt of the IDLE shell or at a blank line in an editor screen the Up and Down arrow keys will cycle through any builtin functions, keyword arguments (mostly errors), or declared variables available, plus True and False.

- <KeyRelease-period>
This has no effect. There is no popup window, and unlike with <Control-Key-space> the arrow keys move the cursor around the screen and do not cycle through any of the Autocomplete options.

- <Key-Tab>
For the sake of brevity, <Key-Tab> works the same as <Control-Key-space> does after a dot, so a_list. and <Key-Tab> lets the Up and Down arrow keys cycle through available methods.

- <KeyRelease-(back)slash>
Within a path string, <KeyRelease-(back)slash> allows for the cycling through of the directories at that level of the path using the Up and Down arrow keys. As with the others, no popup menu is visible when pressing <KeyRelease-(back)slash>. (That is a handy tip I didn't know about... Thanks!)

------------------------

"Alessandro, you could test by making a backup of configextensions.def and removing 'Release' for 'period'."

- When I do this and restart IDLE, the only difference in behavior is that placing a period after an object, a_list., acts like pressing <Key-Tab> or <Control-Key-space> did prior to the change. It allows for the cycling through of methods with the arrow keys, but no popup menu.

------------------------

"Alessandro, you said <KeyRelease-parenleft> does not work.  How abut <Control-Key-backslash> (after '(') to open?  Does <KeyRelease-parenright> close properly?"

- <KeyRelease-parenleft>
Correct. There is no Call Tips popup when I open a parenthesis after an object method.

- <Control-Key-backslash>
This has no effect.

- <KeyRelease-parenright>
I am not sure what your question means. It works as a normal close parenthesis would in any text editor. If you mean does <KeyRelease-parenright> close the Call Tips popup properly, then I can't say as there is no Call Tip popup displaying.

One thing to note, something is happening with <KeyRelease-0> after a closed parenthesis, it is just that nothing is visible. So if I enter a_list.append() and then press and release the 0 key and then press the Up or Down arrow key, the cursor is frozen in place for the first press. Then is starts to move with subsequent presses. It seems like IDLE is trying to get the Call Tip, but no window appears to display the information.

------------------------

"For both boxes, clicking on the box should also close. Does it?
What about Edit -> Show Completions and Edit -> Show calltips for opening?"

- The popup boxes do not display at all. Going through the answers I have given so far, it seems like IDLE is accessing the information that it needs to for Autocomplete (and possibly Call Tips, though I cannot see it as it is never displayed on screen), it is just that the display boxes do not display. Maybe the problem is not Autocomplete or Call Tips at all, but in the module that is called to display the information that they return, or a command in that module was renamed or deprecated?

- Edit -> Show Completions
After reverting back to the backup version of config-extensions.def, this has the same behavior as <Key-Tab> and <Control-Key-space> have. Up and Down Arrow allows cycling through of methods, but there is no popup window visible.

- Edit -> Show calltips
This has no effect, whether it is with an open parenthesis or after the parenthesis has been closed.

Thank you for the reply and trying to find a solution.

~ A
msg248487 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-12 23:13
I did some followup on this today, and could reproduce it with a few lines of Tcl/Tk code. As Ned noted, it seems particular to the ActiveTcl build, as when I built my own 8.5.18 it also worked fine.

(If you're curious, the thing that is failing is the MacWindowStyle call to set the window to type "help". If you use that, the window just doesn't show up. Oddly, other types, e.g. "utility" work properly).

I tried various introspection techniques to see if I could detect that this problem had occurred from code, but no luck. As far as Tk was concerned, the window was there.

Will send a message to tcl-core list regarding this. For reference, Tcl script to reproduce is:

wm geometry . +32+32
toplevel .t
wm geometry .t +60+60
tk::unsupported::MacWindowStyle style .t help "noActivates"
grid [label .t.l -bg yellow -text "tooltip window"]
msg248493 - (view) Author: Kevin Walzer (wordtech) * Date: 2015-08-13 01:29
I experimented with Mark's sample code (thanks for that, BTW), and found that the window with the "help" tag applied would display with this simple addition:

raise .t

I believe the equivalent call in Tinter is lift(), because raise() is for error handling? Perhaps someone can experiment with appropriate calls to lift() in the relevant sections of IDLE. 

The "help" style is excluded from becoming a frontmost window by default in OS X. Here is the relevant code in tkMacOSXWm.c:

- (BOOL) canBecomeKeyWindow
{
    TkWindow *winPtr = TkMacOSXGetTkWindow(self);

    return (winPtr && winPtr->wmInfoPtr && (winPtr->wmInfoPtr->macClass ==
	    kHelpWindowClass || winPtr->wmInfoPtr->attributes &
	    kWindowNoActivatesAttribute)) ? NO : YES;
}


Therefore, an explicit call to raise may be helpful in displaying the window.

I realize that such calls are not present in the current IDLE code, and did not seem to be required previously--there likely was some change in recent Tk-Cocoa commits in event loop handling, memory management, window display, and drawing that caused this new bug to crop up. Tracking the actual source of the bug at the C level is likely to prove very difficult because there have been so many changes. However, since the fix at the script level is trivial, I do not think a major effort is necessary to step through the code at the C level.
msg248494 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-08-13 01:36
Yes, *raise* is a keyword and .lift() is the substitute.
msg248524 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-13 15:15
Awesome, thanks Kevin. Have attached calltip.patch. The extra lift() call doesn't seem to hurt on Windows or X11, so didn't make it conditional.
msg248794 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-18 20:54
Alessandro, would you have a chance to test this one line patch, which makes calltips work again on OS X?
msg251673 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-09-27 00:04
New changeset b5bc7e9dab77 by Terry Jan Reedy in branch '2.7':
Issue #24570: Idle: make calltip and completion boxes appear on Macs
https://hg.python.org/cpython/rev/b5bc7e9dab77

New changeset 6687630e201a by Terry Jan Reedy in branch '3.4':
Issue #24570: Idle: make calltip and completion boxes appear on Macs
https://hg.python.org/cpython/rev/6687630e201a
msg251674 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-09-27 00:19
Added equivalent completion window patch.  Would have preferred confirmation that Idle versions work, but 3.4.4rc1 is only a week away and I think having bug confirmed and fixed in tcl is enough to go with.
msg253370 - (view) Author: Jose M. Alcaide (jmas) Date: 2015-10-23 08:55
This issue continues unfixed.

After uninstalling ActiveTcl 8.5.18 and then installing ActiveTcl 8.5.17, IDLE completion and call tips work again.

Tested with Python 3.5 and 3.4.1.
msg253477 - (view) Author: Jose M. Alcaide (jmas) Date: 2015-10-26 15:53
My previous comment was incorrect, sorry.

I thought that this issue was fixed in time for the release of Python 3.5, but it wasn't (fix was committed on Sep 26, two weeks after 3.5's release).

My apologies.
History
Date User Action Args
2015-10-26 15:53:02jmassetmessages: + msg253477
2015-10-23 08:55:58jmassetnosy: + jmas
messages: + msg253370
2015-09-27 00:19:33terry.reedysetversions: + Python 3.5, Python 3.6
2015-09-27 00:19:20terry.reedysetstatus: open -> closed
messages: + msg251674

assignee: terry.reedy
resolution: fixed
stage: resolved
2015-09-27 00:04:51python-devsetmessages: + msg251673
2015-09-23 01:19:57terry.reedysetmessages: - msg251380
2015-09-23 01:14:18python-devsetnosy: + python-dev
messages: + msg251380
2015-08-18 20:54:01markrosemansetmessages: + msg248794
2015-08-13 15:15:49markrosemansetfiles: + calltip.patch
keywords: + patch
messages: + msg248524
2015-08-13 01:36:51terry.reedysetmessages: + msg248494
2015-08-13 01:29:43wordtechsetmessages: + msg248493
2015-08-12 23:13:01markrosemansetnosy: + markroseman
messages: + msg248487
2015-07-14 03:50:27Alessandro Rosasetmessages: + msg246713
2015-07-11 00:45:04terry.reedysetnosy: + terry.reedy
messages: + msg246589
2015-07-06 18:46:55ned.deilysetnosy: + taleinat
messages: + msg246376
2015-07-06 05:31:03Alessandro Rosasetmessages: + msg246348
2015-07-06 02:27:15wordtechsetmessages: + msg246345
2015-07-05 21:47:10ned.deilysetnosy: + wordtech

messages: + msg246341
title: IDLE Autocomplete and Call Tips Do Not Pop Up -> IDLE Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18
2015-07-05 20:48:27Alessandro Rosacreate