This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use application icon for IDLE
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: kbk, loewis, python-dev, roger.serwy, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2014-01-27 10:08 by serhiy.storchaka, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
idle_appicon.patch serhiy.storchaka, 2014-01-27 10:08 review
idle.gif terry.reedy, 2014-01-28 01:01 Proposed title bar icon
py.gif terry.reedy, 2014-01-28 01:02 Converted from PC/py.ico
python_16x16.gif serhiy.storchaka, 2014-01-29 20:44
python_32x32.gif serhiy.storchaka, 2014-01-29 20:44
python_48x48.gif serhiy.storchaka, 2014-01-29 20:44
20406-34.diff terry.reedy, 2014-01-31 04:45 Requires idle.ico also review
idle_appicon_2.patch serhiy.storchaka, 2014-01-31 08:58 review
Messages (15)
msg209428 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-27 10:08
Currently IDLE use default Tk icon. The proposed patch sets special application icon for IDLE.
msg209492 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-28 01:01
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.
msg209493 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-28 01:02
For comparison.
msg209674 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-29 20:44
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.
msg209676 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-29 20:47
As for desctop icon, see also issue1353344 and issue15869.
msg209691 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-29 23:16
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).
msg209733 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-30 19:15
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.
msg209747 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-31 04:45
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.
msg209752 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-31 08:54
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.
msg209753 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-31 09:54
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?
msg209756 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-01-31 10:09
> 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.
msg210646 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-08 14:05
New changeset bda1739215b4 by Terry Jan Reedy in branch '3.3':
Issue #20406: Use Python application icons for Idle window title bars.
http://hg.python.org/cpython/rev/bda1739215b4

New changeset 3aa6fd1dc2c9 by Terry Jan Reedy in branch 'default':
Issue #20406: Use Python application icons for Idle window title bars.
http://hg.python.org/cpython/rev/3aa6fd1dc2c9
msg210648 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-08 14:24
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?
msg210650 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-02-08 14:34
Yes, it works right on Linux.
msg210654 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-02-08 14:42
New changeset d4f9efd4be7d by Terry Jan Reedy in branch '2.7':
Issue #20406: Use Python application icons for Idle window title bars.
http://hg.python.org/cpython/rev/d4f9efd4be7d
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64605
2014-02-08 14:46:52terry.reedysetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2014-02-08 14:42:47python-devsetmessages: + msg210654
2014-02-08 14:34:05serhiy.storchakasetmessages: + msg210650
2014-02-08 14:24:02terry.reedysetassignee: terry.reedy
messages: + msg210648
2014-02-08 14:05:54python-devsetnosy: + python-dev
messages: + msg210646
2014-01-31 10:09:39serhiy.storchakasetmessages: + msg209756
2014-01-31 09:54:24terry.reedysetmessages: + msg209753
2014-01-31 08:58:04serhiy.storchakasetfiles: + idle_appicon_2.patch
2014-01-31 08:56:42serhiy.storchakasetfiles: - idle_appicon_2.patch
2014-01-31 08:54:59serhiy.storchakasetfiles: + idle_appicon_2.patch

messages: + msg209752
2014-01-31 04:45:40terry.reedysetfiles: + 20406-34.diff

messages: + msg209747
stage: patch review -> commit review
2014-01-30 19:15:33serhiy.storchakasetmessages: + msg209733
2014-01-29 23:16:54terry.reedysetnosy: + loewis
messages: + msg209691
2014-01-29 20:47:56serhiy.storchakasetmessages: + msg209676
2014-01-29 20:44:34serhiy.storchakasetfiles: + python_16x16.gif, python_32x32.gif, python_48x48.gif

messages: + msg209674
2014-01-28 01:02:51terry.reedysetfiles: + py.gif

messages: + msg209493
2014-01-28 01:01:57terry.reedysetfiles: + idle.gif

messages: + msg209492
versions: + Python 2.7, Python 3.3, Python 3.4
2014-01-27 10:08:10serhiy.storchakacreate