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: Add a help() viewer for IDLE's Shell.
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.4
Status: closed Resolution: out of date
Dependencies: Superseder: Squeezer - squeeze large output in IDLE's shell
View: 1529353
Assigned To: Nosy List: Ramchandra Apte, ezio.melotti, roger.serwy, ron_adam, terry.reedy, tomkeus
Priority: normal Keywords: patch

Created on 2011-12-24 06:23 by Ramchandra Apte, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
help_pager.diff roger.serwy, 2012-05-08 02:49 review
issue13659.patch roger.serwy, 2012-10-31 21:15 review
Messages (12)
msg150214 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2011-12-24 06:23
If you call help() a few times on some objects, due to help()'s output IDLE's Shell Window becomes very long and it becomes difficult to scroll through the window.

I suggest a new window should be opened when help() is called in IDLE so that no help output comes in the IDLE Shell Window.

This bug doesn't affect the Python command-line on Linux (and I think Mac OS X) since help() uses the less program to display the help output.
msg150218 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2011-12-24 07:34
Sorry, new window in "I suggest a new window" should be a new read-only editor window.
It could be implemented through a wrapper around help.
IDLE could have a configuration option whether to use the traditional help() or the new help() which opens a new window.
msg150279 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-28 03:07
If you're on Linux, run this as your first command in IDLE:

    import pydoc; pydoc.pager = lambda text: pydoc.tempfilepager(pydoc.plain(text), 'xterm -e less')

If Windows: 

    import pydoc; pydoc.pager = lambda text: pydoc.tempfilepager(pydoc.plain(text), 'notepad')

All help() output for objects will now display outside of IDLE.

The Squeezer extension does something similar for output that is longer than 30 lines.

It should be possible to create a custom pager for the subprocess which communicates with IDLE to display this text. RPCProxy could be used to accomplish this in conjunction with the textView module.
msg150392 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-12-30 21:01
I should like it if a separate window were either automatic or a configuration option for help on modules and classes, which should cover 'long' output.  The Windows workaround, which I will never remember, brings up an extraneous cmd.exe window in addition to notepad.
msg150413 - (view) Author: Ron Adam (ron_adam) * Date: 2011-12-31 07:37
What about having idle open a web browser session with pydocs new browse option?

python3 -m pydoc -b

We've added input fields to the pages that take the same input as help() command does.  It also links to the online help pages, and you can view the source code of the files directly in the browser.  (Sometimes that's the best documentation you can get.)
msg150424 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-12-31 21:00
I would like that to be a help() option, such as help(module, -b) or more verbosely, help(module, browser=True). This would be useful for the regular interactive interpreter as well.
msg160114 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2012-05-06 22:36
I don't think adding a "browser" arg to help() is a good idea.
The original suggestion of having the help in a separate window and adding a checkbox in the options to (de)activate the feature sounds good to me (it could even allow to select between normal/new window/browser).
msg160182 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-05-08 02:49
Attached is an initial diff for creating a separate pager window by using a textView widget. The recently applied patch in issue964437 allows this window to be non-modal, which can be useful for interactive development.

The diff contains code to allow the pager to work with and without a subprocess. The "pager" and "use_help_window" in provide the core functionality. The "use_help_window" presently is a placeholder for implementing Ezio's suggestion in msg160114.

Does anyone know why "import pydoc" is wrapped in a try/except block? I omitted that in "pager".
msg174260 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2012-10-31 04:06
msg174372 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2012-10-31 21:15
The attached patch ("issue13659.patch") adds a configuration option for selecting the output of help() as being in the shell or in the pager. It is an enhancement against 3.4.

Another possibility involves adding a checkable menu item under "Options" or "Help" to enable/disable the help pager.

Please review.
msg179870 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-01-13 13:04
Patch LGTM.
msg336155 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2019-02-20 23:59
#1529353 added squeezer, making this alternative unnecessary.  Once squeezed, output can be opened in a text viewer.
Date User Action Args
2022-04-11 14:57:25adminsetgithub: 57868
2019-02-20 23:59:18terry.reedysetstatus: open -> closed
superseder: Squeezer - squeeze large output in IDLE's shell
messages: + msg336155

resolution: out of date
stage: patch review -> resolved
2014-06-03 15:59:34terry.reedysetmessages: - msg219683
2014-06-03 15:59:25terry.reedysetmessages: - msg219682
2014-06-03 11:20:10tomkeussetmessages: + msg219683
2014-06-03 11:16:11tomkeussetversions: - Python 2.7, Python 3.3
nosy: + tomkeus

messages: + msg219682

type: enhancement -> behavior
2013-06-15 18:50:00terry.reedysetversions: + Python 2.7, Python 3.3
2013-01-13 13:04:26Ramchandra Aptesetmessages: + msg179870
2012-10-31 21:15:29roger.serwysetfiles: + issue13659.patch

stage: needs patch -> patch review
messages: + msg174372
versions: + Python 3.4, - Python 3.3
2012-10-31 04:06:14Ramchandra Aptesetmessages: + msg174260
2012-05-08 02:49:24roger.serwysetfiles: + help_pager.diff
keywords: + patch
messages: + msg160182
2012-05-06 22:36:43ezio.melottisetnosy: + ezio.melotti

messages: + msg160114
stage: needs patch
2011-12-31 21:00:38terry.reedysetmessages: + msg150424
2011-12-31 07:37:14ron_adamsetnosy: + ron_adam
messages: + msg150413
2011-12-30 21:01:42terry.reedysetnosy: + terry.reedy

messages: + msg150392
versions: + Python 3.3
2011-12-28 03:07:19roger.serwysetnosy: + roger.serwy
messages: + msg150279
2011-12-24 07:34:43Ramchandra Aptesetmessages: + msg150218
2011-12-24 06:23:34Ramchandra Aptecreate