Title: IDLE/Tkinter: edit win stops updating when tooltip is active
Type: behavior Stage: patch review
Components: IDLE, Tkinter Versions: Python 3.2, Python 3.3, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: kbk Nosy List: ajaksu2, asvetlov, gpolo, kbk, loewis, ned.deily, pyJohn, python-dev, roger.serwy
Priority: high Keywords: patch

Created on 2009-02-11 19:58 by pyJohn, last changed 2012-03-13 21:47 by loewis. This issue is now closed.

File name Uploaded Description Edit
CallTipWindow.diff roger.serwy, 2009-06-11 23:13 Patch
patch5219.diff roger.serwy, 2011-10-30 17:47
Messages (15)
msg81662 - (view) Author: John DeLuca (pyJohn) Date: 2009-02-11 19:58
In Interpreted Mode, when enter long strings, such as ofile.write (" 
this is a long string...") or print ("this is a long string..."), the 
keyboard entry is delayed - sometimes for 20+ seconds. If one completes 
the string (typing blindly as not text is visible) and keys the 
closing ')', or one moves the entire shell window, the missing text is 
dropped on the entry line and one can continue typing.
This occurs after about 25 characters of the string.
msg81697 - (view) Author: John DeLuca (pyJohn) Date: 2009-02-12 00:51
(pyJohn)... additional information since this is a performance issue: 
Lenovo s10; Win XP; 1GB; Intel Atom 1.66 Mhz
msg86623 - (view) Author: Daniel Diniz (ajaksu2) Date: 2009-04-26 22:18
I think this is a duplicate of issue 1529353.
msg88039 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2009-05-18 17:01
Not issue 1529353.  Edit window stops updating after about 60 
keystrokes when a tooltip window is active.

1. Strings not necessary.  Only occurs when a tooltip is active.  For 
example, if rz is undefined, entering rz( followed by a long key 
sequence won't raise the bug.

2. When the tooltip window closes, the hidden keystrokes appear.  This 
can be triggered by moving the edit window or clicking somewhere. Once 
the tooltip window has closed, things act normally again.

3. Remarkably, one can autorepeat, say, five lines of 'i' with no 
problem.  Then enter another 50 - 60 'i' individually, and the bug 
exhibits.  I thought that typematic processing took place at the 
keyboard driver level, so that Tk would get passed the equivalent of 
single keystrokes.

This bug would be annnoying when entering long parameter tuples, e.g. 
when doing GUI coding.

I'm running Tk 8.5 on WinXP at the moment.   I'm guessing that this is 
a Tk bug.
msg88041 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2009-05-18 18:06
As a workaround, if you need the tooltip, select Edit / Show Calltip 
from the menu or use the hotkey to 'reopen' the tooltip.  That will get 
you another 60 characters.  Otherwise, just hit esc to close the 
tooltip and your keystrokes will appear.
msg88062 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2009-05-19 03:29
Occurs with and w/o the subprocess, but sooner (fewer char) with the 

If the MultiCall wrapper on the EditorWindow Text widget is disabled, 
the bug disappears.
msg88063 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2009-05-19 04:23
Bug exhibits on Linux with Tk 8.4, but requires a couple hundred 
characters to show up.  Also goes away if MultiCall is disabled.
msg89267 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2009-06-11 23:13
I've uploaded a patch to solve the problem.

In, the showtip function binds key releases and button
releases to the checkhide_event function. The checkhide_event function
creates a .after callback to itself whenever it's called. Each key
release adds to a cascade of calls to checkhide_event which results in
Tk slowing down.

When checkhide_event is called from .after, the "event" argument takes
its default of None. Only then should a new .after call be made.
msg146648 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-10-30 17:47
Attached is a patch against 3.2.2 which does proper after_cancel calls on the after calls to checkhide_event.
msg146676 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-31 07:00
I can fairly easily reproduce the hang on a current OS X system and the latest patch appears to solve the problem.  Looks good to me.
msg155645 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-03-13 18:58
I confirm: patch5219.diff solves the problem in linux box.
msg155668 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-13 21:18
New changeset 505c3b7dc539 by Martin v. Löwis in branch 'default':
Issue #5219: Prevent event handler cascade in IDLE.
msg155671 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-13 21:34
New changeset 7e79dbceb039 by Martin v. Löwis in branch '3.2':
Issue #5219: Prevent event handler cascade in IDLE.
msg155674 - (view) Author: Roundup Robot (python-dev) Date: 2012-03-13 21:46
New changeset af1f8adc913b by Martin v. Löwis in branch '2.7':
Issue #5219: Prevent event handler cascade in IDLE.
msg155675 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2012-03-13 21:47
Thanks for the patch and the review.
Date User Action Args
2012-03-13 21:47:19loewissetstatus: open -> closed

nosy: + loewis
messages: + msg155675

resolution: fixed
2012-03-13 21:46:36python-devsetmessages: + msg155674
2012-03-13 21:34:13python-devsetmessages: + msg155671
2012-03-13 21:18:48python-devsetnosy: + python-dev
messages: + msg155668
2012-03-13 18:58:21asvetlovsetnosy: + asvetlov
messages: + msg155645
2011-10-31 07:00:08ned.deilysetnosy: + ned.deily

messages: + msg146676
stage: needs patch -> patch review
2011-10-30 17:47:52roger.serwysetfiles: + patch5219.diff

messages: + msg146648
2011-06-12 18:37:24terry.reedysetversions: + Python 3.3, - Python 2.6, Python 3.1
2010-05-11 20:57:34terry.reedysetversions: - Python 3.0
2009-06-11 23:13:21roger.serwysetfiles: + CallTipWindow.diff

nosy: + roger.serwy
messages: + msg89267

keywords: + patch
2009-05-19 04:23:05kbksetmessages: + msg88063
2009-05-19 03:29:35kbksetmessages: + msg88062
versions: + Python 2.6, Python 3.1, Python 3.2
2009-05-18 18:06:27kbksetmessages: + msg88041
2009-05-18 17:01:36kbksetstatus: pending -> open

assignee: kbk
stage: needs patch
title: IDLE: slowness, pauses enter long strings -> IDLE/Tkinter: edit win stops updating when tooltip is active
nosy: + kbk
versions: + Python 2.7
messages: + msg88039
priority: normal -> high
components: + Tkinter
type: performance -> behavior
2009-04-26 22:18:34ajaksu2setstatus: open -> pending

nosy: + ajaksu2, gpolo
messages: + msg86623
priority: normal
2009-02-12 00:51:58pyJohnsetmessages: + msg81697
2009-02-11 19:58:19pyJohncreate