diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-02-08 14:39:51 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-02-08 14:39:51 (GMT) |
commit | 4ade2d25fc585876540ac9d591a44469fd853462 (patch) | |
tree | 0abb9ac5074156119eaf4582b3db03ad84f1e28a /Lib/idlelib/PyShell.py | |
parent | 79b6f17d701dc641e9a44b21b303e49614b97c09 (diff) | |
download | cpython-4ade2d25fc585876540ac9d591a44469fd853462.zip cpython-4ade2d25fc585876540ac9d591a44469fd853462.tar.gz cpython-4ade2d25fc585876540ac9d591a44469fd853462.tar.bz2 |
Issue #20406: Use Python application icons for Idle window title bars.
Patch mostly by Serhiy Storchaka.
Diffstat (limited to 'Lib/idlelib/PyShell.py')
-rwxr-xr-x | Lib/idlelib/PyShell.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/idlelib/PyShell.py b/Lib/idlelib/PyShell.py index dc3cfe6..a424751 100755 --- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -15,7 +15,7 @@ import io import linecache from code import InteractiveInterpreter -from platform import python_version +from platform import python_version, system try: from Tkinter import * @@ -1536,6 +1536,18 @@ def main(): # start editor and/or shell windows: root = Tk(className="Idle") + # set application icon + icondir = os.path.join(os.path.dirname(__file__), 'Icons') + if system() == 'Windows': + iconfile = os.path.join(icondir, 'idle.ico') + root.wm_iconbitmap(default=iconfile) + elif TkVersion >= 8.5: + ext = '.png' if TkVersion >= 8.6 else '.gif' + iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext)) + for size in (16, 32, 48)] + icons = [PhotoImage(file=iconfile) for iconfile in iconfiles] + root.tk.call('wm', 'iconphoto', str(root), "-default", *icons) + fixwordbreaks(root) root.withdraw() flist = PyShellFileList(root) |