[Tutor] Changing Python icon - 2.6 and 3.2

Marc Tompkins marc.tompkins at gmail.com
Thu Feb 3 19:22:32 CET 2011


On Thu, Feb 3, 2011 at 9:18 AM, Patty <patty at cruzio.com> wrote:

>  Hello Folks - I have Python 2.6.6 on my Windows 7 system and installed
> Python 3.2.  Now I want to be able to differentiate between the versions and
> the icon for each version of Python is the same.  I figured I would change
> the the four application files in the C:\Python26 directory - python;
> python26; pythonw; pythonw26 - and give them new picture icons.  But when
> I select any of these files and choose 'properties', there is no option to
> change the application icon.  I looked online but the questions were not
> exactly the same as this one and pertained to earlier versions of Python
> anyway.  I discovered this when I was trying to associate a folder with 2.6
> based programs so that it would always execute the programs with the python
> 2.6 .exe.  And both Pythons come up as a choice with no details indicating
> which is which, except a lucky guess.
>
> It does appear that I can change the actual name of the application (the
> field with the name allows me to edit) but that is not what I wanted to do,
> also unsure if that would cause a problem in other parts of the application
> down the road if I was changing names like that.
>

Windows EXEs are generally built with one or more icon images packaged
inside them; at build time, the developer chooses which one s/he wants to be
the regular display icon.  As an end user, you generally cannot choose which
of the built-in images Windows will choose to display when you look at the
EXE in a directory listing - Windows sticks with the developer's choice.

However, when you create a shortcut - or modify one that's already been
created - you have free choice of which icon you want to use.  Typically
when you click the "Change Icon" button, you'll see the icons that are
contained in the EXE itself, but you can choose any other icon image file on
your computer - even icons that are contained in completely different EXEs.

Unfortunately, none of that helps with what you're trying to do.  You want
to change the name/description that was registered with Default Programs
when your versions of Python were installed... and as near as I can tell,
the Python installers don't "register" with Default Programs at all.
("Default Programs" is the Vista/7/Longhorn version of... whatever you call
this mess.)  When an installer doesn't provide the information for
registration, Windows defaults to the executable name (which is "python.exe"
in both cases) and the executable's default icon (which, as you've noticed,
hasn't changed between versions either.)

This page describes the registry keys that could/should be set:

http://msdn.microsoft.com/en-us/library/cc144154%28v=vs.85%29.aspx#post_install
but I don't know whether messing with them by hand is likely to be either
safe or effective.

However, one thing you CAN do is to create shortcuts for the actual .py or
.pyw files themselves, and in the shortcut's command line specify the path
to the Python executable you want to use (e.g. "C:\Python26\pythonw.exe
C:\Users\Patty\Desktop\PythonProj26\myprog.py".)  If we're talking about
just a few files, that could be doable.  For more than about a dozen, it
would be an unbelievable pain.
-- 
www.fsrtechnologies.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110203/3420088d/attachment-0001.html>


More information about the Tutor mailing list