Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use application icon for IDLE #64605

Closed
serhiy-storchaka opened this issue Jan 27, 2014 · 15 comments
Closed

Use application icon for IDLE #64605

serhiy-storchaka opened this issue Jan 27, 2014 · 15 comments
Assignees
Labels
topic-IDLE type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 20406
Nosy @loewis, @terryjreedy, @kbkaiser, @serwy, @serhiy-storchaka
Files
  • idle_appicon.patch
  • idle.gif: Proposed title bar icon
  • py.gif: Converted from PC/py.ico
  • python_16x16.gif
  • python_32x32.gif
  • python_48x48.gif
  • 20406-34.diff: Requires idle.ico also
  • idle_appicon_2.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2014-02-08.14:46:52.787>
    created_at = <Date 2014-01-27.10:08:10.623>
    labels = ['expert-IDLE', 'type-feature']
    title = 'Use application icon for IDLE'
    updated_at = <Date 2014-02-08.14:46:52.786>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-02-08.14:46:52.786>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2014-02-08.14:46:52.787>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2014-01-27.10:08:10.623>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['33745', '33759', '33760', '33804', '33805', '33806', '33820', '33823']
    hgrepos = []
    issue_num = 20406
    keywords = ['patch']
    message_count = 15.0
    messages = ['209428', '209492', '209493', '209674', '209676', '209691', '209733', '209747', '209752', '209753', '209756', '210646', '210648', '210650', '210654']
    nosy_count = 6.0
    nosy_names = ['loewis', 'terry.reedy', 'kbk', 'roger.serwy', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20406'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    Currently IDLE use default Tk icon. The proposed patch sets special application icon for IDLE.

    @serhiy-storchaka serhiy-storchaka added topic-IDLE type-feature A feature request or enhancement labels Jan 27, 2014
    @terryjreedy
    Copy link
    Member

    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.

    @terryjreedy
    Copy link
    Member

    For comparison.

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka
    Copy link
    Member Author

    As for desctop icon, see also bpo-1353344 and bpo-15869.

    @terryjreedy
    Copy link
    Member

    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 bpo-15869 in favor of bpo-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).

    @serhiy-storchaka
    Copy link
    Member Author

    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 bpo-1490384.

    @terryjreedy
    Copy link
    Member

    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.

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @terryjreedy
    Copy link
    Member

    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?

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 8, 2014

    New changeset bda1739215b4 by Terry Jan Reedy in branch '3.3':
    Issue bpo-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 bpo-20406: Use Python application icons for Idle window title bars.
    http://hg.python.org/cpython/rev/3aa6fd1dc2c9

    @terryjreedy
    Copy link
    Member

    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?

    @terryjreedy terryjreedy self-assigned this Feb 8, 2014
    @serhiy-storchaka
    Copy link
    Member Author

    Yes, it works right on Linux.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 8, 2014

    New changeset d4f9efd4be7d by Terry Jan Reedy in branch '2.7':
    Issue bpo-20406: Use Python application icons for Idle window title bars.
    http://hg.python.org/cpython/rev/d4f9efd4be7d

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants