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: display python version on idle title bar
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.4, Python 3.5, Python 2.7
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Saimadhav.Heblikar, Todd.Rovito, bagratte, edmond.burnett, eric.araujo, ezio.melotti, python-dev, rhettinger, roger.serwy, terry.reedy, westley.martinez
Priority: normal Keywords: easy, patch

Created on 2013-03-10 12:56 by bagratte, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue17390.patch edmond.burnett, 2013-03-16 17:58 review
issue17390_editor_title.patch edmond.burnett, 2013-04-02 22:31 Adds description and Python version to IDLE's editor window title in review
issue17390_editor_title_rev2.patch kjohnson, 2013-04-13 16:34 Revised patch to add Python version to editor window title review
issue17390_outputwindow.patch westley.martinez, 2014-02-27 04:53 review
taskbar.png bagratte, 2014-04-02 20:33 screenshot of taskbar on windows 7
Messages (37)
msg183874 - (view) Author: bagrat lazaryan (bagratte) Date: 2013-03-10 12:56
useful for those who routinely use different versions of python on idle. as it ships, idle displays "python shell" on its title bar. it would be useful to have there the version displayed as well.

msg183929 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-03-11 04:43
Sounds like a good idea to me.  Would you like to propose a patch?  The devguide contains information to do that.

Hint: sys.version is not meant to be parsed, there is sys.version_info for that (no regex needed! :)
msg183932 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-03-11 05:12
I agree. Sometimes when I have multiple IDLE windows open I have to scroll back to the top to make sure which one I am in.  I suggest:
Python x.y Shell for shell window
I am not sure, for edit window: currently -- <path>/
I am not sure the redundancy is needed, but I do tended to look at the isolated file name. Maybe " -- in <path>/" without filename at end.
Add 'Python x.y', 'Py x.y' 'x.y', beginning or end of line?
msg183957 - (view) Author: bagrat lazaryan (bagratte) Date: 2013-03-11 13:18
class PyShell(OutputWindow):

    import platform
    version = platform.python_version() + " " + platform.architecture()[0]
    shell_title = "Python %s Shell" % version

i'll take a look at the devguide and see if i can figure a patch out.
msg183963 - (view) Author: bagrat lazaryan (bagratte) Date: 2013-03-11 14:25
or better still:

from platform import python_version, architecture
    shell_title = "Python %s %s Shell" % (python_version(), architecture()[0])
msg184128 - (view) Author: Edmond Burnett (edmond.burnett) * Date: 2013-03-14 02:16
Suggesting a patch which addresses this enhancement. I did not include  architecture() in the title bar but can add it as well if others think it is appropriate.

Import of platform.python_version is done at the top of rather than inside the class as per PEP8.
msg184161 - (view) Author: bagrat lazaryan (bagratte) Date: 2013-03-14 12:43
good. thank you.

i'm not sure about the architecture. i understand it's not crucial for most of the users. i would like to have it though.
msg184338 - (view) Author: Edmond Burnett (edmond.burnett) * Date: 2013-03-16 17:49
Updated patch to conform to PEP3101
msg184613 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-03-19 07:23
The 0 in "{0}" can be omitted, otherwise patch looks good to me.  I agree that the architecture is not necessary.
msg184620 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-03-19 08:41
I have been planning to test and commit some version of this patch after PEP434 is resolved, as I would like to backport it at least to 2.7 and 3.3. The only thing that could break is some esoteric application that looks at window title bars from outside and looks for an exact match rather than startswith('IDLE') or the equivalent.
msg184621 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-03-19 08:43
I think it's safe to apply this patch to 2.7/3.2/3.3/3.4.
msg185594 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-03-30 22:23
Edmond: please fill in, sign, and send by your preferred method a PSF Contributor Agreement
(back up a level for more explanation)

For a patch more complicated than this, the CA would now be required before applying a patch of yours.
msg185595 - (view) Author: Edmond Burnett (edmond.burnett) * Date: 2013-03-30 22:29

I submitted my contributor form on March 15th, and received the confirmation, but it has not yet been applied to my account.

I saw some discussion on one of the mailing lists of there being a potential backlog due to the PyCon sprints, so I just assumed that I was still waiting in the queue. If there is someone in particular I should contact at this point, I'm happy to do this.

msg185598 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-03-30 22:51
New changeset 74d9a9507019 by Terry Jan Reedy in branch '3.3':
Issue #17390: Display Python version on Idle title bar. Patch by Edmond Burnett.

New changeset e0f66c924544 by Terry Jan Reedy in branch 'default':
Merge from 3.3: Issue #17390

New changeset 225022955c65 by Terry Jan Reedy in branch '2.7':
Issue #17390: Display Python version on Idle title bar. Patch by Edmond Burnett.
msg185599 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-03-30 23:06
Can you find the place where the editor title is set? I am currently thinking of something like

Python x.y.z: (directory path)  # or
Python x.y.z Editor: xxx.y (path)

I am guessing that the reason to put the file name at the beginning is in case the path is so long that the end gets cut off.

(Let's give the secretary a couple more weeks to catch up.)
msg185863 - (view) Author: Edmond Burnett (edmond.burnett) * Date: 2013-04-02 22:31
Here is a patch to add a more descriptive title to the IDLE editor.

Python <version> Editor: <filename> - <path>
msg186230 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2013-04-07 17:30
Issue10747 is tangentially related. It is about adding the python version to the short cuts on Windows.
msg186751 - (view) Author: Kent Johnson (kjohnson) * Date: 2013-04-13 16:34
issue17390_editor_title.patch is not correct, it changes the title on any window that inherits from EditorWindow, including the shell window. Here is a new patch that changes short_title() instead of saved_change_hook(), so it can be overridden by derived classes. This is the same method used to change the title of the shell window.

Derived classes of EditorWindow are PyShellEditorWindow and OutputWindow. OutputWindow overrides short_title() and IIUC PyShellEditorWindow should use the same title as a normal editor window.
msg208787 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-01-22 12:03
Why this issue has been closed even though people were still discussing it and submitting patches?

Terry, can you check if the new patches should be applied?
msg208834 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-22 18:05
I presume the OP only cared about the Shell Window, and that was fixed.
I agree that submitted patches should not be ignored. I have decided I really want editor windows labelled as sometimes run the *same* file with more than one version, and it can be difficult to remember which window will run with which version. My only question is whether 'Python x.y Editor' will be too much to add in addition to the short and long file name, but after being undecided for months, I think the best thing is to add it and see.
msg208880 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-01-23 05:40
New changeset bcfbab86f49a by Terry Jan Reedy in branch '2.7':
Issue #17390: Add Python version to Idle editor window title bar.

New changeset b26db63bb931 by Terry Jan Reedy in branch '3.3':
Issue #17390: Add Python version to Idle editor window title bar.
msg208881 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-01-23 06:29
Edmond and Kent, thanks for the patch.  Ezio, thanks for re-opening.

After testing the patch with and without 'Editor', I preferred without. It is slightly redundant and noisy, especially when editing ;-). Also, Windows 7 stacks icons for windows belonging to a program under the program icon on the task bar. When the mouse is over the program icon, it pop up a window of *limited* width listing the window titles. The popup is narrow enough that paths to Idle test files in my repository clone get truncated when 'Editor' is added.

I suspect that adding '''else: filename = "Untitled"''' to short_title() makes the corresponding '''else: title = "Untitled"''' in saved_change_hook() useless. I will check later for possible removal.

Since I sometimes have multiple Find in File Output windows, I would like to expand their titles also. Since the Python version is irrelevant. I am thinking of
  Python: Matches for "<re>"
But I think their may be other uses of Output windows (easily found by searching for "Output" ;-).  In any case, extensions and new features should be free to use use OutputWindow. So we cannot generically modify OutputWindow.short_title . If the self parameter of short_title does not somehow indicate that the output is for Find in Files, we can subclass and over-ride.

class FiFWindow(OutputWindow):
  def short_title(self):
    return <fif title>
msg212336 - (view) Author: Westley Martínez (westley.martinez) * Date: 2014-02-27 04:53
How about adding an optional argument to OutputWindow that specifies the title for the window?  Or would this be more suitable for EditorWindow (which OutputWindow inherits from)?  Either way, doing this would allow any OutputWindow to specify its own title.  The current title "Output", is pretty useless.

I've written a patch that adds the functionality. In addition, I changed the title of the Find in Files output window to what you imagined.
msg212337 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-27 05:46
That looks like a sensible approach.
msg215287 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-01 00:36
As far as I can tell, there are 4 window classes to be concerned with. (Dialogs would be a separate issue.)

|- PyShellEditorWindow - EW+breakpoints, replaces WE in PyShellFileList
|- OutputWindow - used by Find in Files
   |- PyShell - the visible shell window

PyShellEditorWindow does not override the title methods and is of no concern to us.

If we want the title for all these windows to start with 'Python', we should 'factor' that out and start with it at the beginning of EditorWindow.saved_change_hook (and change other things in EW). Thinking ahead, another possible use for OutputWindow is for containing the result of running an external program on a file. I think that a leading 'Python' would be fine something like
  Python: PyFlakes output for

Adding the flexibility of a title parameter to OutputWindow instead of EditorWindow seems about right. If we do that, the override of .short_title for PyShell in the first patch should be removed and the title passed in to the one and only call that creates a PyShell (, 315).

I would like to add some minimal automated tests (maybe in a new file) using either mock classes or unittest.mock (which I have not used yet).
msg215388 - (view) Author: bagrat lazaryan (bagratte) Date: 2014-04-02 15:28
the filename should be the first thing on the titlebar of idle editor window. that way, on taskbar, one can see the file that's open in editor. i suggest the format of editor's title be changed to: - python x.y.z - path
or whatever you will as separator between elements.
msg215393 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-02 18:45
Bagrat, are you on XP by any chance? In Win7, all windows for a program are attached to one program icon on the taskbar, which has the program name. When I hover over the program icon, mini views of each window are displayed, with each window view showing about 30 chars of the window title. For instance "Python 3.4.0: CallTipsWindow", which is fine for me. Moving the mouse over the mini window displays the complete title.
msg215399 - (view) Author: bagrat lazaryan (bagratte) Date: 2014-04-02 20:33
terry, i'm on 7 but i have my taskbar configured not to combine buttons. see the screenshot attached.

(does anyone know why on earth i am not receiving email notifications when someone posts to an issue i have started or i have commented to?)
msg215406 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-04-02 21:25
Other editors (e.g. Kate) use the format "filename - editor name".  This is common for other applications as well (e.g. Firefox uses "page title - Mozilla Firefox"), so the request seems reasonable to me.

If you want to go the extra mile you could have an option to decide if the filename should be first or not or even a format string that would allow users to fully configure the titlebar (e.g. "{file} - IDLE {version}"), but that might be out of the scope of this issue.  FWIW I don't think Kate has an option for that, but it has one to show the full path in titlebar.

(@bagrat: assuming your email address is correct, if you are not getting notifications they might have ended up in the spam folder.)
msg215422 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-04-03 03:56
The general issue of Idle title bars is definitely not finished, though I may close this issue and open others.

1. 'Python' versus "Idle' versus neither in titles (assuming not both).

1a. Shell: Since the link in msg183874 is dead, I don't know what Bagrat suggested. I said 'Python' in msg183932, hinted 'Idle' in msg184620, and pushed the patch that had 'Python'.  I could argue either way, but 'Python x.y.z Shell' (versus 'Idle x.y.z Shell') works as the name of the Idle product and also identifies what will run the code entered. I am now thinking 'neither' and propose making the title 'Shell x.y.z' -- see the more on this below.

1b. Editor: The patch I applied followed the same pattern, and again, I could argue for either 'Idle x.y.z' (what is doing the editing) or 'Python x.y.z' (what will run the code with F5)'. In this and the shell case, the version is the most important new information. If we consider the titles of other windows (see still more below), I think the class title should be 'Editor x.y.z'.

1c. OutputWindow: This is a bit tougher. 'Output' only works, sort of, as long as the class is only used for FIF, (Find in Files, grep). The initial title is actually '*Output*', indicating unsaved content, with no file name specified. Once saved, the title changes to "Output - <file name>". This is a precedent for 'Editor - <file name>'

Since this issue started about adding versions, and version is not relevant to this and the following windows, a patch for OutputWindows should be a new issue. However, the design options need to be considered together.

1d. Read-only windows: We have "Debug Control", "Path Browser", and "Class Browser - Output Window". (For the last, "- Output Window" should go since it adds nothing and misleads in that the window is not an OutputWindow. It could be replaced with the class name.)

2. Order of generic and specific (or class and instance) components.

Most windows have a generic title for windows of a class. Part of my thinking above in suggesting 'Shell x.y.z' and 'Editor x.y.z' for the respective classes is that none of the class titles should contain either 'Python' or 'Idle' [separate? issue 0 -- it would be a correction of the patches on this issue]. 

Once an OutputWindow is saved, its title has a generic and specific component, in that order. The specific component identifies the specific contents of the instance. While I expect to replace 'Output' with names that reflect the subclasses of usage, the pattern will remain the same [separate issue 1].

Before we added a generic component for editor windows, they were unique in not having one. They currently follow the output pattern.

I am also thinking a giving the title for ClassBrowswer (which is really ModuleBrowser) a specific component -- the module name [separate issue 2].

My point is that we have gone from one generic-specific (class-instance) name pair to two, and soon to more. If someone wants one pair flipped, then it seems logical to me that the same person would want all such pairs flipped, for the same reason. Bagrat, is this true for you? I know you only mentioned editor pairs, but you may not have known about output pairs, and certainly not future pairs that do not exist yet. I am willing to consider a user-settable option [separate issue 3], but I would think it should cover all such pairs, and not just editor window pairs.

Currently, editor window titles are also unique in repeating part of the specific title. Output windows, when saved, do not repeat the short file name. Do any other editor programs do this?

I expect we may decide to eliminate the redundancy as it exist now. Notepad++ puts "<complete path> - Notepad++" on the title bar and the filename on the notebook tab. When the tabbed selected changes, the title bar changes. Firefox does the title to match the tab also.

There is already an issue to use tabbed notebooks with Idle and when we do that, I would expect to remove the duplication in the title and imitate Notepad++.
msg215427 - (view) Author: bagrat lazaryan (bagratte) Date: 2014-04-03 07:39
terry, i indeed didn't know about output windows. (or at least i didn't know i knew. by the way, what are they?) the logic behind my request is that the file being edited in the editor is the most important thing of the editor. a quick glance at the taskbar, for those like me that have it set not to combine taskbar buttons, or for those on xp and the like, should reveal what is what.

(terry, i received your email but still none from issue tracker, neither in spam. the last notification i received was that of msg186751, back in 2013. do you think i should file an issue on meta tracker?)
msg215489 - (view) Author: Westley Martínez (westley.martinez) * Date: 2014-04-04 05:02
I second that the title should start with the filename, by default.  This seems to be the precedent, and it makes it easy when working with multiple files.

Example: - IDLE x.y.z: C:\mydir\

Terry, I think we can generalize this as '<important/useful title> - <general>: <specific>' and apply it to all windows.  The first element essentially guarantees that the title name will be a good one for the taskbar.  We can apply this to say the FIF output window:
Matches for "hello" - IDLE x.y.z: C:\output.txt

but maybe everything after the hyphen isn't necessary.  I wonder if long titles could be annoying or distracting.  Regardless, anything more specific than 'Output Window' will be better.
msg219195 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-05-27 01:57
I taught a python class this week with Python 2.7.7 and the learners found this change to be an impediment to usability.

The filename and fullpath are the most important pieces of information in the title bar.   They are now obscured by the version information which is somewhat unimportant (it has already been shown in the shell window and it is uncommon to run multiple versions of python using IDLE at the same time).

Looking to Microsoft Excel and Word as comparative examples, they only show the document name.

I conclude that this change should be reverted.  For the time being, I can't continue to use IDLE in 2.7.7 to teach with.  Not seeing the filename is especially important when many small windows are open (as they usually are during tdd and pdb sessions).
msg219200 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-05-27 05:13
Since no title format can satisfy everyone, I propose to make it user configurable. The default can be the old style. I opened #21588 for that and marked it high priority.
msg219738 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2014-06-04 01:22
I don't know if this is related but the Window tab has been affect as well.  It shows all open windows like this

  *Python 2.7.7 Shell*
  Python 2.7.7: /Users/raymond/class/
  Python 2.7.7: /Users/raymond/class/

This is a bit over the top :-)

I would really like the old behavior restored.
msg223064 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-14 22:32
I agree that the repeated 'Python x.y.z: " in the listing is too much.  #21588 has a patch but I am not ready to push it or do the review and revision needed . So I propose to reduce the current prefix to the minimum needed to know what version F5 will run the file with, x.y with minimal dressing, and put it in the middle or at the end. Your example Windows listing would then look like

  *Python 2.7.7 Shell* (2.7) /Users/raymond/class/ (2.7) /Users/raymond/class/
  *Python 2.7.7 Shell* - /Users/raymond/class/ (2.7) - /Users/raymond/class/ (2.7)
  *Python 2.7.7 Shell* - /Users/raymond/class/ | 2.7 - /Users/raymond/class/ | 2.7

Which do you like best?  I am trying out the second one in my 3.4 installation, and will switch to the third later.
msg225328 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-08-15 01:55
New changeset 6d41f139709b by Terry Jan Reedy in branch '2.7':
Issue #17390: Adjust Editor window title. Remove 'Python', move version to end.

New changeset ba141f9e58b6 by Terry Jan Reedy in branch '3.4':
Issue #17390: Adjust Editor window title. Remove 'Python', move version to end.
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61592
2014-08-15 01:56:43terry.reedysetstatus: open -> closed
resolution: fixed
stage: test needed -> resolved
2014-08-15 01:55:50python-devsetmessages: + msg225328
2014-07-14 22:32:32terry.reedysetmessages: + msg223064
2014-06-04 15:26:28Saimadhav.Heblikarsetnosy: + Saimadhav.Heblikar
2014-06-04 12:08:48kjohnsonsetnosy: - kjohnson
2014-06-04 01:22:36rhettingersetmessages: + msg219738
2014-05-27 05:13:35terry.reedysetpriority: high -> normal

messages: + msg219200
versions: + Python 3.5, - Python 3.3
2014-05-27 01:57:38rhettingersetpriority: normal -> high
nosy: + rhettinger
messages: + msg219195

2014-04-04 05:02:02westley.martinezsetmessages: + msg215489
2014-04-03 07:39:47bagrattesetmessages: + msg215427
2014-04-03 03:56:18terry.reedysetmessages: + msg215422
2014-04-02 21:25:39ezio.melottisetmessages: + msg215406
2014-04-02 20:33:01bagrattesetfiles: + taskbar.png

messages: + msg215399
2014-04-02 18:45:55terry.reedysetmessages: + msg215393
2014-04-02 15:28:02bagrattesetmessages: + msg215388
2014-04-01 00:36:08terry.reedysetmessages: + msg215287
stage: needs patch -> test needed
2014-02-27 05:46:39terry.reedysetmessages: + msg212337
2014-02-27 04:53:18westley.martinezsetfiles: + issue17390_outputwindow.patch

messages: + msg212336
2014-02-26 20:06:48westley.martinezsetnosy: + westley.martinez
2014-01-23 06:29:56terry.reedysetmessages: + msg208881
stage: patch review -> needs patch
2014-01-23 05:40:11python-devsetmessages: + msg208880
2014-01-22 18:05:31terry.reedysetstatus: pending -> open
resolution: fixed -> (no value)
messages: + msg208834
2014-01-22 12:03:46ezio.melottisetstatus: closed -> pending

messages: + msg208787
stage: needs patch -> patch review
2014-01-09 01:43:20bagrattesetstatus: open -> closed
resolution: fixed
2013-04-13 16:34:20kjohnsonsetfiles: + issue17390_editor_title_rev2.patch
nosy: + kjohnson
messages: + msg186751

2013-04-07 17:30:33roger.serwysetmessages: + msg186230
2013-04-02 22:31:43edmond.burnettsetfiles: + issue17390_editor_title.patch

messages: + msg185863
2013-03-30 23:06:13terry.reedysetmessages: + msg185599
stage: commit review -> needs patch
2013-03-30 22:51:19python-devsetnosy: + python-dev
messages: + msg185598
2013-03-30 22:29:10edmond.burnettsetmessages: + msg185595
2013-03-30 22:23:29terry.reedysetassignee: terry.reedy
messages: + msg185594
versions: + Python 2.7, Python 3.3
2013-03-24 05:30:06Todd.Rovitosetnosy: + Todd.Rovito
2013-03-19 08:43:46ezio.melottisetmessages: + msg184621
2013-03-19 08:41:27terry.reedysetmessages: + msg184620
2013-03-19 07:23:17ezio.melottisetnosy: + ezio.melotti

messages: + msg184613
stage: needs patch -> commit review
2013-03-16 17:58:13edmond.burnettsetfiles: + issue17390.patch
2013-03-16 17:57:23edmond.burnettsetfiles: - issue17390.patch
2013-03-16 17:50:15edmond.burnettsetfiles: - idle_shell_version_display-3.4.0a0.patch
2013-03-16 17:49:55edmond.burnettsetfiles: + issue17390.patch

messages: + msg184338
2013-03-14 12:43:28bagrattesetmessages: + msg184161
2013-03-14 02:16:49edmond.burnettsetfiles: + idle_shell_version_display-3.4.0a0.patch
versions: - Python 2.7, Python 3.2, Python 3.3
nosy: + edmond.burnett

messages: + msg184128

keywords: + patch
2013-03-11 14:25:05bagrattesetmessages: + msg183963
2013-03-11 13:18:29bagrattesetmessages: + msg183957
2013-03-11 05:12:21terry.reedysetnosy: + roger.serwy
messages: + msg183932
2013-03-11 04:43:01eric.araujosetversions: - Python 2.6, Python 3.1, Python 3.5
nosy: + eric.araujo, terry.reedy

messages: + msg183929

keywords: + easy
stage: needs patch
2013-03-10 12:56:34bagrattecreate