classification
Title: IDLE: no calltips on MacOS with tk 8.6
Type: behavior Stage: resolved
Components: IDLE, macOS Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: miss-islington, ned.deily, rhettinger, ronaldoussoren, serhiy.storchaka, taleinat, terry.reedy, walters, wordtech
Priority: normal Keywords: patch

Created on 2018-07-30 02:16 by terry.reedy, last changed 2018-08-03 03:50 by terry.reedy. This issue is now closed.

Files
File name Uploaded Description Edit
calltip_w.diff wordtech, 2018-08-01 02:58
calltips_w-2.diff wordtech, 2018-08-01 10:54
Pull Requests
URL Status Linked Edit
PR 8639 merged terry.reedy, 2018-08-03 02:21
PR 8642 merged miss-islington, 2018-08-03 02:50
PR 8643 merged miss-islington, 2018-08-03 02:50
PR 8644 merged terry.reedy, 2018-08-03 03:07
Messages (16)
msg322647 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-30 02:16
In #34055, Raymond said "tool tips no longer display on the newest mac builds".  On idledev, Walter S reported the same using 64-bit python.org "Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwin" on multiple machines with 10.13.5.  He also verified that the htest part of 'python3 -m idlelib.calltip_w' fails (no calltip appears when typing '('.

I have doubts that this is a new problem with IDLE.  calltip.py was not touched for 3.7.0.  calltip_w.py was only touched to change return None to return 'break' where appropriate.

This is one of 3 new Mac-specific failures reported after the release of 3.7.0.  The others are #34047, scrolling problems, and #34120, freeze on some dialog closings.  I have to suspect that the problem is with tkinter (_tkinter) and the new tcl/tk 8.6.8.

How to debug (help appreciated with any of these):
1. Run the 3.6.6 32/64 bit binary, compiled against tk 8.5 instead of 8.6, and see if the same problems occur.  Any problems that do are not 8.6 specific.
2. Find minimal failing cases with as little IDLE-specific code as possible.
3. Trace execution of the IDLE code with prints or debugger to find the point of failure.  For this issue, I would start with adding print calls in the function that creates the tip window.
msg322696 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-30 23:41
Two more pieces of evidence that there is a problem with tkinter/tk8.6 on Mac.  On #34120, Vlad T. confirmed the misbehavior on 3.5 compiled for 8.6.  #34281 reports another problem with an editor subwindow on 3.7 Mac.

There are now 4 issues about some IDLE feature failing specifically on MacOS with tcl/tk 8.6.8.  (All but 1 with 3.7.0.)
#34047: editor scrollbar slider 'sticks' at bottom
#34120: freeze when closing config and about dialogs
#34281: (new today) wrong window activates when closing "Go to Line" box
#34275: (this issue) calltips do not appear

The editor scrollbar was touched last May.  The config and about dialogs contents were edited last summer.  But the calltip and and goto code is essentially untouched for 2 years.

I am changing the title from 'IDLE: no calltips on MacOS with tk 8.6' and adding tkinter as component and Serhiy as Nosy.

I have never used a Mac, but I have available a 2012 MacBook Air, which I just upgraded to current High Sierra 10.13.6.  I intend to install 3.7, confirm the bugs, and try to find simpler failing examples.  But I cannot patch _tkinter, let alone tcl/tk.
msg322713 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-31 02:39
With 64 bit 3.7.0, I verified multiple problems.  Calltips do not display either automatically or manually with ^B or menu selection.  I closed #34281 in favor of #34120 and will report there and on #34047.
msg322727 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-07-31 06:11
https://core.tcl.tk/tk/tktview/769367b4c9b8e4fc05afaf67dc0aa6e3c1dba682 is an Tcl/Tk issue about issue34275, which is also about Tooltips. 

I've added a comment to the Tk issue to note that IDLE also has problems (the other ticket is about a 3th-party library).
msg322763 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-07-31 12:40
Please provide a short working Python script that reproduces the problem. Also, please point me to the internal implementation of tooltips in idlelib. Tooltips work just fine on Tk on the Mac, but there are many different ways to implement them and I suspect Python's implementation can likely be tweaked. It also may be related to event handling.
msg322765 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-07-31 12:46
@terry.reed: Kevin Walzer is a maintainer for Tk on macOS.

I know too little of IDLE to answer his questions.
msg322824 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-07-31 22:11
IDLE currently uses tooltips only for calltips describing a function's call signature.  Within Lib/idlelib:
calltip.py (renamed from calltips.py after the 3.7.0/3.6.6 release) has the logic for when to raise one and its content.
calltip_w.py (which I intend to merge into calltip.py) has the code for the calltip itself and its closing.

Issue #1529353 and PR7626) proposes a second use of tooltips. I would also like to add helptips to some dialog fields and if possible, some menu entries.

tooltip.py has simple generic tooltip code.  calltip_w does not import this but says in its docstring 'after tooltip.py'. Since tooltip is not currently used anywhere in IDLE, I have considered removing it.

Issue #33839 and PR7683 instead propose to upgrade tooltip and refactor calltip_w to import and use tooltip.  I have held off merging the PR because of tooltips not working on Mac.  But I need to do so soon to unblock the issue above and possible other enchancements.

Both tooltip and calltip_w have run-when-main test functions that work on Windows (and I presume Linux) but fail on 10.13.6 with 3.7.0.  The tooltip test is simpler in that it does not involve any truly IDLE-specific code.  The calltip_w test does not involve calltip.  Both use IDLE's human-verification test driver that provides a root window with test instructions.  In the bash terminal, run
python3 -m idlelib.tooltip
python3 -m idlelib.calltip_w

Kevin, I would be very appreciative if you can suggest a tweak that makes tooltips work everywhere.
msg322836 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-08-01 02:58
With the attached patch, the calltip now displays in the test in calltips_w.py on macOS. As I suspected, a judicious call to "update" forces the event loop to cycle on macOS. It should be harmless on other platforms, but if it causes some sort of performance slowdown, it can be wrapped in a call to "tk windowingsystem" eq "aqua" (not sure how to implement that in this module) so it only runs on the Mac. I also removed the platform call to "MacWindowStyle" as it is no longer needed on recent versions of the Mac.
msg322843 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-01 05:39
Thank you! Adding update worked for calltip_w.  Adding update to tooltip and copying
   tw.lift()  # work around bug in Tk 8.5.18+ (issue #24570)
from calltip worked for tooltip.  (It seems the bug is still present. ;-)  I will either patch these files directly or modify the patch for #33839 tomorrow.
msg322846 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-08-01 06:44
Perhaps we can use .update_idletasks() rather than .update()? That tends to have less of a performance hit. My macOS setup is currently not working so I can't test this myself.

Regarding the "MacWindowStyle" call, IDLE is backported to older versions of Python and generally strives to support older systems. Can you tell which versions of macOS/OSX this is needed in? If so, I suggest surrounding that call with an OS version check, which could be removed at a later time when the relevant OS versions are truly irrelevant.
msg322855 - (view) Author: Kevin Walzer (wordtech) * Date: 2018-08-01 10:54
Tal, your proposed revisions to the patch work fine. It's harmless to leave the older calls to MacWindowStyle there. New patch attached.
msg323009 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-03 02:13
I verified for my machine also that adding .update_idletasks(), as in calltips_2-2.diff works for my 3.7.0 installation.  I will assume until someone says otherwise that this is generally sufficient.

I am preparing a PR with the patch and will separately deal with the merge conflict I expect for PR7683.
msg323013 - (view) Author: miss-islington (miss-islington) Date: 2018-08-03 03:33
New changeset 363105e546709339e3419ada9daf5efa0b3b1e18 by Miss Islington (bot) in branch '3.6':
bpo-34275: Make IDLE calltips always visible on Mac.  (GH-8639)
https://github.com/python/cpython/commit/363105e546709339e3419ada9daf5efa0b3b1e18
msg323014 - (view) Author: miss-islington (miss-islington) Date: 2018-08-03 03:39
New changeset ffd6364745dbeb7269c0e4376b63bf76bc44bcc6 by Miss Islington (bot) in branch '3.7':
bpo-34275: Make IDLE calltips always visible on Mac.  (GH-8639)
https://github.com/python/cpython/commit/ffd6364745dbeb7269c0e4376b63bf76bc44bcc6
msg323015 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-03 03:40
New changeset 24a54da9452efb21d30dc56c6b9d0977d08ae452 by Terry Jan Reedy in branch '2.7':
 [2.7] bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639) (GH-8644)
https://github.com/python/cpython/commit/24a54da9452efb21d30dc56c6b9d0977d08ae452
msg323016 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-03 03:50
Thank you again, Kevin.
History
Date User Action Args
2018-08-03 03:50:43terry.reedysetstatus: open -> closed
resolution: fixed
messages: + msg323016

stage: patch review -> resolved
2018-08-03 03:40:23terry.reedysetmessages: + msg323015
2018-08-03 03:39:40miss-islingtonsetmessages: + msg323014
2018-08-03 03:33:50miss-islingtonsetnosy: + miss-islington
messages: + msg323013
2018-08-03 03:07:35terry.reedysetpull_requests: + pull_request8147
2018-08-03 02:50:19miss-islingtonsetpull_requests: + pull_request8146
2018-08-03 02:50:11miss-islingtonsetpull_requests: + pull_request8145
2018-08-03 02:27:35terry.reedysetcomponents: - Tkinter
title: Problems with tkinter and tk8.6 on MacOS -> IDLE: no calltips on MacOS with tk 8.6
2018-08-03 02:21:31terry.reedysetpull_requests: + pull_request8143
2018-08-03 02:13:42terry.reedysetassignee: terry.reedy
stage: needs patch -> patch review
messages: + msg323009
versions: + Python 2.7
2018-08-01 21:41:47terry.reedyunlinkissue34120 dependencies
2018-08-01 10:54:55wordtechsetfiles: + calltips_w-2.diff

messages: + msg322855
2018-08-01 06:44:15taleinatsetmessages: + msg322846
2018-08-01 05:39:13terry.reedysetmessages: + msg322843
2018-08-01 02:58:31wordtechsetfiles: + calltip_w.diff
keywords: + patch
messages: + msg322836
2018-07-31 22:11:08terry.reedysetmessages: + msg322824
2018-07-31 12:46:52ronaldoussorensetmessages: + msg322765
2018-07-31 12:40:49wordtechsetnosy: + wordtech
messages: + msg322763
2018-07-31 06:11:21ronaldoussorensetmessages: + msg322727
2018-07-31 02:39:36terry.reedysetmessages: + msg322713
2018-07-31 02:34:21terry.reedyunlinkissue34281 dependencies
2018-07-30 23:48:09terry.reedylinkissue34120 dependencies
2018-07-30 23:45:44terry.reedylinkissue34281 dependencies
2018-07-30 23:41:13terry.reedysettitle: IDLE: no calltips on MacOS with tk 8.6 -> Problems with tkinter and tk8.6 on MacOS
nosy: + serhiy.storchaka

messages: + msg322696

assignee: terry.reedy -> (no value)
components: + Tkinter
2018-07-30 02:16:41terry.reedycreate