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

IDLE: no calltips on MacOS with tk 8.6 #78456

Closed
terryjreedy opened this issue Jul 30, 2018 · 16 comments
Closed

IDLE: no calltips on MacOS with tk 8.6 #78456

terryjreedy opened this issue Jul 30, 2018 · 16 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes OS-mac topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 34275
Nosy @rhettinger, @terryjreedy, @ronaldoussoren, @taleinat, @ned-deily, @serhiy-storchaka, @miss-islington
PRs
  • bpo-34275: Make IDLE calltips always visible on Mac.  #8639
  • [3.7] bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639) #8642
  • [3.6] bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639) #8643
  • [2.7] bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639) #8644
  • Files
  • calltip_w.diff
  • calltips_w-2.diff
  • 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 = 'https://github.com/terryjreedy'
    closed_at = <Date 2018-08-03.03:50:43.792>
    created_at = <Date 2018-07-30.02:16:41.094>
    labels = ['OS-mac', '3.8', 'expert-IDLE', 'type-bug', '3.7']
    title = 'IDLE: no calltips on MacOS with tk 8.6'
    updated_at = <Date 2018-08-03.03:50:43.790>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2018-08-03.03:50:43.790>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2018-08-03.03:50:43.792>
    closer = 'terry.reedy'
    components = ['IDLE', 'macOS']
    creation = <Date 2018-07-30.02:16:41.094>
    creator = 'terry.reedy'
    dependencies = []
    files = ['47725', '47726']
    hgrepos = []
    issue_num = 34275
    keywords = ['patch']
    message_count = 16.0
    messages = ['322647', '322696', '322713', '322727', '322763', '322765', '322824', '322836', '322843', '322846', '322855', '323009', '323013', '323014', '323015', '323016']
    nosy_count = 9.0
    nosy_names = ['rhettinger', 'terry.reedy', 'ronaldoussoren', 'taleinat', 'wordtech', 'ned.deily', 'serhiy.storchaka', 'miss-islington', 'walters']
    pr_nums = ['8639', '8642', '8643', '8644']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue34275'
    versions = ['Python 2.7', 'Python 3.6', 'Python 3.7', 'Python 3.8']

    @terryjreedy
    Copy link
    Member Author

    In bpo-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 bpo-34047, scrolling problems, and bpo-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.

    @terryjreedy terryjreedy self-assigned this Jul 30, 2018
    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes OS-mac topic-IDLE type-bug An unexpected behavior, bug, or error labels Jul 30, 2018
    @terryjreedy
    Copy link
    Member Author

    Two more pieces of evidence that there is a problem with tkinter/tk8.6 on Mac. On bpo-34120, Vlad T. confirmed the misbehavior on 3.5 compiled for 8.6. bpo-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.)
    bpo-34047: editor scrollbar slider 'sticks' at bottom
    bpo-34120: freeze when closing config and about dialogs
    bpo-34281: (new today) wrong window activates when closing "Go to Line" box
    bpo-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.

    @terryjreedy terryjreedy removed their assignment Jul 30, 2018
    @terryjreedy terryjreedy changed the title IDLE: no calltips on MacOS with tk 8.6 Problems with tkinter and tk8.6 on MacOS Jul 30, 2018
    @terryjreedy
    Copy link
    Member Author

    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 bpo-34281 in favor of bpo-34120 and will report there and on bpo-34047.

    @ronaldoussoren
    Copy link
    Contributor

    https://core.tcl.tk/tk/tktview/769367b4c9b8e4fc05afaf67dc0aa6e3c1dba682 is an Tcl/Tk issue about bpo-34275, 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).

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Jul 31, 2018

    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.

    @ronaldoussoren
    Copy link
    Contributor

    @terry.reed: Kevin Walzer is a maintainer for Tk on macOS.

    I know too little of IDLE to answer his questions.

    @terryjreedy
    Copy link
    Member Author

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

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Aug 1, 2018

    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.

    @terryjreedy
    Copy link
    Member Author

    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 bpo-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 bpo-33839 tomorrow.

    @taleinat
    Copy link
    Contributor

    taleinat commented Aug 1, 2018

    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.

    @wordtech
    Copy link
    Mannequin

    wordtech mannequin commented Aug 1, 2018

    Tal, your proposed revisions to the patch work fine. It's harmless to leave the older calls to MacWindowStyle there. New patch attached.

    @terryjreedy
    Copy link
    Member Author

    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.

    @terryjreedy terryjreedy self-assigned this Aug 3, 2018
    @terryjreedy terryjreedy changed the title Problems with tkinter and tk8.6 on MacOS IDLE: no calltips on MacOS with tk 8.6 Aug 3, 2018
    @miss-islington
    Copy link
    Contributor

    New changeset 363105e by Miss Islington (bot) in branch '3.6':
    bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639)
    363105e

    @miss-islington
    Copy link
    Contributor

    New changeset ffd6364 by Miss Islington (bot) in branch '3.7':
    bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639)
    ffd6364

    @terryjreedy
    Copy link
    Member Author

    New changeset 24a54da by Terry Jan Reedy in branch '2.7':
    [2.7] bpo-34275: Make IDLE calltips always visible on Mac. (GH-8639) (GH-8644)
    24a54da

    @terryjreedy
    Copy link
    Member Author

    Thank you again, Kevin.

    @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 OS-mac topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants