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.

Title: Refactor icon setting to a separate function for Turtle
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.8
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: Al.Sweigart, ned.deily, serhiy.storchaka, terry.reedy, willingc
Priority: normal Keywords:

Created on 2015-04-12 18:00 by Al.Sweigart, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
patch_issue_23922 Al.Sweigart, 2015-04-12 22:54 review
Messages (8)
msg240564 - (view) Author: Al Sweigart (Al.Sweigart) * Date: 2015-04-12 18:00
The and turtledemo scripts launch windows that have the default tkinter icon. Instead, they should make use of the IDLE icon (which are already in the idlelib/Icons folder)
msg240567 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-04-12 20:23
Or perhaps a generic Python ioon.  Is there a tkinter icon?  I think the default is just the Tk-supplied icon.  Also, there are platform differences.  AFAIK, on OS X the application icon cannot be changed while running; information about icon files is specified in the app bundle Info.plist.  For OS X framework builds, launching (for example, via double-click) results in an IDLE icon.  Opening turtledemo (or, for that matter, idle from the command line) causes the default Python icon to be used, from the bundle located within the framework.  Running tkinter apps with non-framework builds default to the Tk icon if no app bundle is used.  So, I think there is nothing to be done here for OS X but one needs to be aware of the platform differences when testing.
msg240573 - (view) Author: Al Sweigart (Al.Sweigart) * Date: 2015-04-12 22:54
On my system (Windows 7) it shows up with a blue feather icon, which I is the generic Tk icon.

The reason I suggest the IDLE icon is 1) we already have it and 2) it's the python logo on top of a generic sheet of paper icon so it fits well enough imo, and 3) I'm assuming that the use of the turtle demo and IDLE are pretty intertwined anyway.

I've attached a patch which I've tested on Windows, but I'm away from my other machines right now.
msg240703 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2015-04-13 18:41
Creating a new import dependency to idlelib.PyShell in doesn't seem like a good idea since does not currently need to be used with IDLE (unlike turtledemo which does have an existing dependency on idlelib).  Perhaps a better way would be to add an option to turtle.cfg to allow users to specify an icon file and have turtledemo set it to the IDLE one if used from IDLE?
msg240804 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-04-13 23:22
The blue feather is the tk 8.6 icon.  The tk 8.5 and before icon is a red script 'Tk'.

The title bar icons for Idle were added in #20406.  It was a bit of a challenge to get them to work right and look good enough for all versions on all systems.  The icons were taken from the repository PC directory, which does not get installed.  I forget whether the ones committed were direct copies or modified.  I know I had in mind some future editing.  See msg209747

I agree with the general idea.  However, PEP 434 defines the idlelib api as mostly private.  Indeed, I might like to someday rename and refactor  Rather than add an idlelib dependency (in particular to turtle, I would prefer to move generic tkinter code to the tkinter tree.  (I might even like to remove the idlelib dependency from turtledemo this way, but this is a future issue.)

In this case, the tkinter addition would be a new method on the application window or toplevel class: def set_icon(self, icon_dir, icon_file): <code pretty much as already written>.  Icon_file is the base name which gets .ico, .gif, or .png added.  This non-obvious code would then be available to all.  Serhiy, what do you think of this?

However, I have no reason to rename the icon files, so turtle could reuse those.  But a better application icon for turtle and turtledemo might be new icons with the two snakes on the back of a turtle shell.
msg296681 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2017-06-23 06:45
PyShell is now pyshell.  I think factoring the icon setting into a separate function is a good idea, separate from turtle and turtledemo.  I am leaving this issue open for that, for 3.6/7.

I don't think the turtle/turtledemo icons matter that much.  I will not patch them.
msg319755 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2018-06-16 15:49
I've updated the issue title to reflect Terry's comments and changed the stage to needs patch.
msg319784 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-06-16 20:56
I am closing and rejecting this as not worth the bother and "ain't gonna happen" at things now stand.  

The 'IDLE icons' are not IDLE icons.  They are Python application icons which I adapted for IDLE.  The one on the Windows taskbar are set by the Windows installer.

The IDLE code could be copied into turtle (where it might stagnate if tk changes), but this would require making turtle a package.  Not worth it.
I don't consider using the tk icons that big a problem.  They work across platforms and the tk people will continue to make sure they do.  I would not be terribly surprised is some beginners think that the blue feature *is* a turtle logo ;-).

To use the IDLE code directly, it should be in a public interface module.  I am willing to create one within idlelib, but there would be opposition, so this is off the table for now.

I think there should be a utility module under tkinter, but Serhiy has shown no interest, and I am not going to divert my energy to pushing this at present.  In any case, I think such a proposal should be a clean new issue.
Date User Action Args
2022-04-11 14:58:15adminsetgithub: 68110
2018-06-16 20:56:03terry.reedysetstatus: open -> closed
versions: + Python 3.8, - Python 3.7
messages: + msg319784

resolution: rejected
stage: needs patch -> resolved
2018-06-16 15:49:26willingcsetnosy: + willingc
title: and turtledemo use the default tkinter icon -> Refactor icon setting to a separate function for Turtle
messages: + msg319755

versions: - Python 3.6
stage: test needed -> needs patch
2017-06-23 06:45:51terry.reedysettype: enhancement
stage: test needed
messages: + msg296681
versions: + Python 3.6, Python 3.7, - Python 3.5
2015-04-13 23:22:34terry.reedysetnosy: + serhiy.storchaka
messages: + msg240804
2015-04-13 18:41:04ned.deilysetnosy: + terry.reedy
messages: + msg240703
2015-04-12 22:54:11Al.Sweigartsetfiles: + patch_issue_23922

messages: + msg240573
2015-04-12 20:23:48ned.deilysetnosy: + ned.deily
messages: + msg240567
2015-04-12 18:00:14Al.Sweigartcreate