There are two icon issues. First is the window icon at the left of the title bar of Idle windows. By the name 'wm_iconphote', I presume this is what this issue is about. Until recently, it *was* the red 'Tk' that is generally used for Tk windows. It is slightly different from idlelib/Icons/tk.gif so it must be in the tk code.
For 3.4.0, since the change to tcl/tk 8.6, there are two changes. First the Tk icon is changed to a nearly vertical blue feather. Second, when displayed on the window title bar (as opposed to the Windows taskbar popup listing application windows), it is no longer displayed on the title bar directly but is placed in a square brown background with a white outline. It is atrociously ugly. The same is used for other Tk windows. (On the Windows taskbar popup window listing app windows, only the feather itself appears on the overall light blue background.)
So I agree that we need to explicitly set the window title bar icon. I tried the snake (python.gif) and like it better than the feather. It appears on a black square with no outline. Unlike the feather, the same is true on the taskbar popup. Perhaps the background is created by Windows after analyzing the colors in the icon. Visually, it is not much better than the red Tk, but I definitely think we should have a consistent Idle icon.
That particular snake is not the current Python logo and it is not Idle specific. Most apps (on Windows at least) use a miniture version of the app icon for the title bar icon. PC/py.ico is close to the Idle icon (see below) but is suffers when converted to py.gif (which I will attach in another message). The attached idle.gif is a cleaned up version of py.gif. It might be tweaked slightly. Or it might be redrawn from the console title bar icon, but I did not find the latter in the repository. In any case, I think we should add an idle.gif and use it in all versions. Otherwise, the patch looks good.
(The other .gifs are used in TreeWidget. Idle.icns is an Apple icon collection format, though I do not know if it is actually used.)
The other icon issue is the desktop and (on Windows at least) taskbar icon. Currently, when I first install Idle with the Windows installer, it uses the black console icon with Python icon in the lower right. After rebooting, it switches to a white spiral binder page with Python logo on the lower right. This seems to be specific to Idle and is appropriate as it represent the white Idle shell versus the black console. Once upon a time, Idle used this 'idle icon' when first installed, but something changed a few versions ago. There is another issue about this regression on the tracker.

We can steal icon from http://www.python.org/favicon.ico. It contains three
variants for different size (16, 32 and 48 pixels). Here is extracted and
converted to GIF images. Please try them and original favicon on Windows. Or
may be we even can cut larger icon from large official Python logo.

Martin: is the medium 'python logo on white page' icon used in the Start menu in the repository or otherwise accessible? If not, could you upload it?
---
I closed #15869 in favor of #1353344.
Tk does not load .ico files (I tried). idle.gif is 16x16 because pc/py.ico is. That seems to be the standard default size for file lists, menus, including context menus, and title bars. On the other hand, I have my system set for larger type and gui objects, so I am better off with 24x24 or downscaled 32x32 icons. (So python_32x32 looks better than the 16x16 version.)
I would like to use an 'idle' icon for Idle windows rather than the generic Python icon. I just noticed that there is a smaller 'white page with python logo' used for the Idle entry in the start menu#. It is not just a scaled-down version of the large white-page icon used on the taskbar. It is different from and better than py.ico. I think this is what we should use as menu and title bar icons are usually the same.
* The same icon is also used for the 'Module docs' entry, which is supposed to be bring up a tkinter window running a pydoc script (it does in 2.7).

I think that all icons used in Windows installer are in the repository. All four ico-files in the PC directory contains 7 images: 16, 32 and 48 pixels size and 4-, 8- and 32-bits per pixel. Three of them (except PC/launcher.ico) were added in issue1490384.

I see. MS Paint just pulled out one of the 16-pixel images. Photoshop (like Tk) refused to open the file. However, I found the following:
iconbitmap = wm_iconbitmap(self, bitmap=None, default=None)
Set bitmap for the iconified widget to BITMAP. Return
the bitmap if None is given.
Under Windows, the DEFAULT parameter can be used to set the icon
for the widget and any descendents that don't have an icon set
explicitly. DEFAULT can be the relative path to a .ico file
(example: root.iconbitmap(default='myicon.ico') ).
This works* with default=<py.ico> for Windows and is available in 2.7, while wm_iconphoto is not. I think we should use it for Windows. (I get the impression from the help text that default= only works for Windows, but I cannot test this.) See uploaded 3.4 patch. I plan to apply this before the next release.
Someone else will have to add tested elif: clauses for other systems. For X, iconphoto might be better, as it accepts multiple bitmaps (of various sizes) and packages them for X. Images could be extracted from py.ico for this purpose. Or maybe just the 32-bit 32 pixel image in py.ico, save as the best quality .gif, would be enough. Iconphoto help says it does not work for Macs; the iconbitmap help says nothing, so maybe it does.
* The title icon I see is better than than the 16 pixel gif extracted from py.ico, so I presume it is downsized from a 32 pixel version. Unlike any .gif, transparency is handled correctly. However, Tk somehow distorts the colors and it is much darker than the same-size Start menu icon. For the white page part, I like the darker outline and page holes.better. For the two snakes, it is much worse. The bright yellow-orange snake is instead a dull brownish orange and not properly recognizable as the Python snake. I renamed py.ico to idle.ico so someone could edit the colors to look better when run through Tk without having to rename the file and change the code later. (I would want to rename after editing so no one would think it identical to PC/py.ico.) But I do not think a commit should wait on an image edit.

Yes, the default option of wm_iconbitmap works only on Windows. Does wm_iconbitmap affect taskbar icon and icon used in task switching?
Here is a patch which supports also X11 systems. I'm nor sure about Mac.

Yes, 'works' means displayed for title bar and task switching.
Related but separate issue. A TreeWidget used for browsing files uses the old python.gif icon for .py files. I think we should switch to the modern one that you uploaded as python_16x16.gif. Agree?

> Related but separate issue. A TreeWidget used for browsing files uses the
> old python.gif icon for .py files. I think we should switch to the modern
> one that you uploaded as python_16x16.gif. Agree?
Agree.
As for 2.7, we can use
root.tk.call('wm', 'iconphoto', str(root), "-default", *icons)
In Ubuntu (and perhaps other Linux distributives), just main Python logo (as
in favicon) is used as IDLE desktop icon. May be we should discuss IDLE icon
and logo (which can be shown in the About window) on Python-Dev.

For 2.7, this substitution
#root.wm_iconphoto(True, *icons)
root.tk.call('wm', 'iconphoto', str(root), "-default", *icons)
does not work on Windows. If I change the test string "Windows" to force execution to the tk.call above, the icon is a black square, which is worse than the Tk icon. Does it work right on linux?