diff -r 4641d8d99a7d Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Sat May 19 16:52:33 2012 +0100 +++ b/Lib/idlelib/PyShell.py Sat May 19 09:15:08 2012 -0700 @@ -1458,6 +1458,16 @@ if tkversionwarning: shell.interp.runcommand(''.join(("print('", tkversionwarning, "')"))) + # Mac OS X - make the GUI window rise to the top + if os.path.exists("/usr/bin/osascript"): + applescript = """ +tell application "System Events" + set proc to first process whose unix id is %d + set frontmost of proc to true +end tell +""" % (os.getpid()) + os.system("/usr/bin/osascript -e '%s'" % applescript) + root.mainloop() root.destroy()