Mark Roseman added the comment:

I reproduced your problem on Windows, and verified that it wasn't an issue on 
either Mac or Linux.

Your fix however, didn't change anything for me (on a Windows 7 VM). I tried a 
few other things (raising the window, playing with various wm attributes, etc.) 
with no luck.

The fact that it works ok when run directly from the command prompt got me 
thinking, and I eventually tracked down what is preventing IDLE from becoming 
the front application.

It's actually an internal Windows feature, that's designed to prevent 
background applications from all of a sudden putting up windows that interfere 
with what you're doing in the foreground, instead putting a notification in the 
task bar and making you click that or the window itself.

The mechanism used is to prevent applications from coming to the front on their 
own if they don't do so very shortly after they're first launched. So when you 
launch a Python shell (e.g. from a command prompt), the "delay" it takes you to 
type "import idlelib.idle" plus the launch time exceeds this timeout, and 
Windows decides it won't allow it to put the window in the foreground.

You can change the timeout (or set it to 0 to disable the feature) via the 
registry key HKEY_CURRENT_USER\Control Panel\Desktop\ForegroundLockTimeout
(you need to restart after). With that change, your fix worked for me.

You can Google around for "ForegroundLockTimeout" for additional info.

There's not realistically an easy way to get around it in IDLE itself (for 
obvious reasons, given the purpose of the feature).

I'm guessing this will affect few people as much as it does you, constantly 
starting and stopping IDLE from within Python. If the fix works on your system, 
especially without mucking with that registry key, that should cover it. The 
fix doesn't cause any harm on Mac or Linux.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24889>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to