This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author markroseman
Recipients markroseman, serhiy.storchaka, terry.reedy
Date 2015-08-19.22:09:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440022187.75.0.265644158636.issue24889@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2015-08-19 22:09:47markrosemansetrecipients: + markroseman, terry.reedy, serhiy.storchaka
2015-08-19 22:09:47markrosemansetmessageid: <1440022187.75.0.265644158636.issue24889@psf.upfronthosting.co.za>
2015-08-19 22:09:47markrosemanlinkissue24889 messages
2015-08-19 22:09:46markrosemancreate