That’s because what you have isn’t really a Python problem.
Originally Posted by gabbro
I guess you use IDLE since F5 seems to be the “Run module” key in it.
Activation and focussing of windows is the job of the window manager, not Python. I prefer “focus follows mouse” so I’m usually fine with active windows being in the background but I understand it may appear tricky to the uninitiated. Maybe you can fine tune these settings in Macs too? (Or maybe not.)
My armada: openSUSE 13.1 (home desktop, home laptop), Crunchbang Linux 11 (work laptop), Trisquel GNU/Linux 6.0.1 (mini laptop), Ubuntu 14.04 LTS (server), Android 4.2.1 (tablet), Windows 7 Ultimate (testbed)