[Pythonmac-SIG] Desktop shortcut for IDLE

Chris Rebert pythonmac at rebertia.com
Wed Oct 14 01:19:02 CEST 2009


On Wed, Oct 7, 2009 at 12:40 PM, Gregor Lingl <gregor.lingl at aon.at> wrote:
> Hi,
>
> I'm relatively new to the Mac.
> I have a Python 3.1.1. installation on my Macbook
> and I'd like to have a shortcut on my desktop starting
> IDLE with the -n switch, that is without subprocess
>
> Under Windows I'd rightclick on the desktop, create a
> new shortcut and then enter as the target:
>
> C:\Python31\pythonw C:\Python31\Lib\idlelib\idle.pyw -n
> Then I have to give it a name and it's ready. (Additionally
> I have the option to change the icon)
>
> Is there a similar and similarly simple way to do this
> with Mac OS X? (Leopard)
>
> I am able to start IDLE in this mode from a terminal,
> but thats rather cumbersome
>
> python3
> /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/idlelib/idle.py
> -n
>
> So Id' like to automate it. (I observed, that the IDLE entry in the program
> folder
> is not a simple shortcut, so I couldn't find a way to edit an alias of it,
> in order
> to add the -n option.)

Well, you could make a shell script (call it "idle-n.sh"):

echo "#!/bin/sh" > ~/Desktop/idle-n.sh
echo "python3 /Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/idlelib/idle.py
-n" >> ~/Desktop/idle-n.sh
chmod a+x ~/Desktop/idle-n.sh

Then Cmd+I the shell script in Finder, and drag a new icon over the
existing one in the inspector (this worked in testing with another
file of a different type).

Cheers,
Chris
--
http://blog.rebertia.com


More information about the Pythonmac-SIG mailing list