Title: IDLE: Use tabbed shell and edit windows
Type: enhancement Stage: patch review
Components: IDLE Versions: Python 3.6, Python 3.5, Python 2.7
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: giampaolo.rodola, gpolo, markroseman, roger.serwy, terry.reedy
Priority: normal Keywords: patch

Created on 2010-07-14 17:31 by terry.reedy, last changed 2015-08-26 15:51 by markroseman.

File name Uploaded Description Edit roger.serwy, 2011-08-26 20:11 Extension to provide tabbed window support
tmtabs.png markroseman, 2015-08-12 16:22 tab design in TextMate
newtabs.png markroseman, 2015-08-23 17:09 markroseman, 2015-08-26 15:49 markroseman, 2015-08-26 15:51
Messages (10)
msg110301 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-07-14 17:31
The addition of tabbed windows to web browsers was a great advance that is now standard. For Windows, it eliminated the crowding of the taskbar. I suspect it made switching easier on all systems.

The addition of the same to IDLE would have similar benefits. I often have a shell and two edit windows open.

This would require, I believe, the use of ttk.Notebook, which requires tcl/tk 8.5+ or the Tile extension. Can this be made a requirement for IDLE in 3.2? Windows has 8.5 now. *nix users can add Tile if they have 8.4. I do not know the situation for Mac.
msg110305 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2010-07-14 17:51
It is possible to create a tabbed window without ttk.Notebook. This is already being done in the configuration dialog. The real issue goes much beyond ttk.Notebook, check the patch "tabs_ttk_and_co.diff" at for an earlier work on this (there is also a screenshot in the wiki over there showing the final result).
msg110308 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-07-14 18:01
Changed title to match new info. Tabs might also be used for any pop-up windows that would benefit from persistence. [JEdit does this, but being non-language-specific, it does not have a shell with error traceback.]
msg110906 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2010-07-20 14:56
(Note: there has recently been some discussion of this on idle-dev and python-dev.)

This may be nice to have but has complications. I think there are currently more pressing issues regarding IDLE that require our attention.

Also, just adding tabs isn't necessarily enough. Having several separate windows should still be an option. And if you can have several windows, each with several tabs, drag-n-drop moving of tabs between windows is really nice to have, not to mention drag-n-drop reordering of tabs.
msg143031 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-08-26 20:11
Attached is an extension which provides tabbed windows for IDLE. It supports drag-and-drop reordering and separate windows. 

The implementation relies on monkey-patching a few subroutines and duck-typing for the toplevel window. The extension emulates each tab as if it were its own toplevel object. 

There can be flickering when switching tabs due to swapping the toplevel menu bar. This seems to be a limitation of Tk.
msg248461 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-12 16:22
Roger's extension is an amazingly cool hack. With some of the decoupling mentioned in #24826, the actual switching should get easier.

Regarding cosmetics, I wanted to make a suggestion. The tabs provided by ttk::notebook aren't ideally suited for this task, both visually on some platforms (hello Mac) and also because they're designed for a fixed (small) number of tabs.

One of the better implementations of tabs I've seen is in the Mac editor TextMate. I've attached a set of annotated screenshots as tmtabs.png. It's nice and clean. Doing this as a widget based on the Tkinter canvas looks very feasible.
msg248463 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2015-08-12 17:05
A tabbed widget, however implemented, should be a component that can either be in a Toplevel with menu by itself, or added to an application window (#24826).
msg249012 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-23 17:09
I've put together a standalone tabs widget (mostly done) based on Tk canvas widget, that emulates the behaviour of TextMate's tabs. I was able to modify Roger's extension to use this widget. See attached screenshot newtabs.png (tabs area is fully functioning, bottom debug area is just UI).
msg249204 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-26 15:49
Have attached  From the header comments:

Standalone 'tabs' widget to switch between multiple different views.

Unlike the Tkinter ttk.Notebook widget, this widget is suitable for
displaying a potentially large number of tabs, as might be found in a
tabbed editor. If there are too many tabs to show based on the available
width, the remainder can be viewed via a popup menu on the last tab.

Tabs can be rearranged by dragging, closed, or new tabs added. Each tab
can have a title which is displayed in the tab, a tooltip for when the
mouse hovers over the tab, and a 'dirty' indicator that can be used to
indicate files needing to be saved.

The appearance and behaviour of the tabs is strongly influenced by the
TextMate editor on Mac OS X.

Implementation is via a single Tkinter canvas.

Unlike many other tabbed widgets, this widget does not take care of
actually switching content being displayed; this is left to the caller.

A UITabsObserver (see below) must be provided to the widget, and is
used to notify the caller when changes are made that must be reflected
in other parts of the user interface.
msg249205 - (view) Author: Mark Roseman (markroseman) * Date: 2015-08-26 15:51
Have attached, which is Roger's tab extension, hacked to use instead of the UI previously built into that extension.
Date User Action Args
2015-08-26 15:51:51markrosemansetfiles: +

messages: + msg249205
2015-08-26 15:49:32markrosemansetfiles: +

messages: + msg249204
2015-08-23 17:09:47markrosemansetfiles: + newtabs.png

messages: + msg249012
2015-08-12 17:08:32brian.curtinsetnosy: - brian.curtin
2015-08-12 17:08:09terry.reedylinkissue24826 dependencies
2015-08-12 17:05:51terry.reedysetmessages: + msg248463
2015-08-12 16:22:28markrosemansetfiles: + tmtabs.png

messages: + msg248461
versions: + Python 2.7, Python 3.5, Python 3.6, - Python 3.3
2015-08-07 23:43:04markrosemansetnosy: + markroseman
2014-02-04 12:05:36taleinatsetnosy: - taleinat
2012-02-24 10:53:31ezio.melottisetkeywords: + patch
stage: needs patch -> patch review
versions: + Python 3.3, - Python 3.2
2011-08-26 20:11:16roger.serwysetfiles: +

messages: + msg143031
2011-01-09 16:35:51roger.serwysetnosy: + roger.serwy
2010-07-20 15:24:23brian.curtinsetnosy: + brian.curtin
2010-07-20 14:56:05taleinatsetnosy: + taleinat
messages: + msg110906
2010-07-14 18:08:51giampaolo.rodolasetnosy: + giampaolo.rodola
2010-07-14 18:01:59terry.reedysetmessages: + msg110308
title: IDLE: Use ttk.Notebook for tabbed windows -> IDLE: Use tabbed shell and edit windows
2010-07-14 17:51:31gpolosetnosy: + gpolo
messages: + msg110305
2010-07-14 17:31:47terry.reedycreate