Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit e471ab3

Browse files
committed
Merge with 3.4, Issue python#24028: Add subsection about Idle calltips.
2 parents c69b37f + 37f8135 commit e471ab3

File tree

2 files changed

+59
-11
lines changed

2 files changed

+59
-11
lines changed

Doc/library/idle.rst

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,35 @@ Note that IDLE itself places quite a few modules in sys.modules, so
435435
much can be found by default, e.g. the re module.
436436

437437
If you don't like the ACW popping up unbidden, simply make the delay
438-
longer or disable the extension. Or another option is the delay could
439-
be set to zero. Another alternative to preventing ACW popups is to
440-
disable the call tips extension.
438+
longer or disable the extension.
439+
440+
Calltips
441+
^^^^^^^^
442+
443+
A calltip is shown when one types :kbd:`(` after the name of an *acccessible*
444+
function. A name expression may include dots and subscripts. A calltip
445+
remains until it is clicked, the cursor is moved out of the argument area,
446+
or :kbd:`)` is typed. When the cursor is in the argument part of a definition,
447+
the menu or shortcut display a calltip.
448+
449+
A calltip consists of the function signature and the first line of the
450+
docstring. For builtins without an accessible signature, the calltip
451+
consists of all lines up the fifth line or the first blank line. These
452+
details may change.
453+
454+
The set of *accessible* functions depends on what modules have been imported
455+
into the user process, including those imported by Idle itself,
456+
and what definitions have been run, all since the last restart.
457+
458+
For example, restart the Shell and enter ``itertools.count(``. A calltip
459+
appears because Idle imports itertools into the user process for its own use.
460+
(This could change.) Enter ``turtle.write(`` and nothing appears. Idle does
461+
not import turtle. The menu or shortcut do nothing either. Enter
462+
``import turtle`` and then ``turtle.write(`` will work.
463+
464+
In an editor, import statements have no effect until one runs the file. One
465+
might want to run a file after writing the import statements at the top,
466+
or immediately run an existing file before editing.
441467

442468
Python Shell window
443469
^^^^^^^^^^^^^^^^^^^

Lib/idlelib/help.html

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,12 +417,33 @@ <h3>25.5.2.2. Completions<a class="headerlink" href="#completions" title="Permal
417417
Note that IDLE itself places quite a few modules in sys.modules, so
418418
much can be found by default, e.g. the re module.</p>
419419
<p>If you don&#8217;t like the ACW popping up unbidden, simply make the delay
420-
longer or disable the extension. Or another option is the delay could
421-
be set to zero. Another alternative to preventing ACW popups is to
422-
disable the call tips extension.</p>
420+
longer or disable the extension.</p>
421+
</div>
422+
<div class="section" id="calltips">
423+
<h3>25.5.2.3. Calltips<a class="headerlink" href="#calltips" title="Permalink to this headline"></a></h3>
424+
<p>A calltip is shown when one types <tt class="kbd docutils literal"><span class="pre">(</span></tt> after the name of an <em>acccessible</em>
425+
function. A name expression may include dots and subscripts. A calltip
426+
remains until it is clicked, the cursor is moved out of the argument area,
427+
or <tt class="kbd docutils literal"><span class="pre">)</span></tt> is typed. When the cursor is in the argument part of a definition,
428+
the menu or shortcut display a calltip.</p>
429+
<p>A calltip consists of the function signature and the first line of the
430+
docstring. For builtins without an accessible signature, the calltip
431+
consists of all lines up the fifth line or the first blank line. These
432+
details may change.</p>
433+
<p>The set of <em>accessible</em> functions depends on what modules have been imported
434+
into the user process, including those imported by Idle itself,
435+
and what definitions have been run, all since the last restart.</p>
436+
<p>For example, restart the Shell and enter <tt class="docutils literal"><span class="pre">itertools.count(</span></tt>. A calltip
437+
appears because Idle imports itertools into the user process for its own use.
438+
(This could change.) Enter <tt class="docutils literal"><span class="pre">turtle.write(</span></tt> and nothing appears. Idle does
439+
not import turtle. The menu or shortcut do nothing either. Enter
440+
<tt class="docutils literal"><span class="pre">import</span> <span class="pre">turtle</span></tt> and then <tt class="docutils literal"><span class="pre">turtle.write(</span></tt> will work.</p>
441+
<p>In an editor, import statements have no effect until one runs the file. One
442+
might want to run a file after writing the import statements at the top,
443+
or immediately run an existing file before editing.</p>
423444
</div>
424445
<div class="section" id="python-shell-window">
425-
<h3>25.5.2.3. Python Shell window<a class="headerlink" href="#python-shell-window" title="Permalink to this headline"></a></h3>
446+
<h3>25.5.2.4. Python Shell window<a class="headerlink" href="#python-shell-window" title="Permalink to this headline"></a></h3>
426447
<ul>
427448
<li><p class="first"><tt class="kbd docutils literal"><span class="pre">C-c</span></tt> interrupts executing command</p>
428449
</li>
@@ -440,7 +461,7 @@ <h3>25.5.2.3. Python Shell window<a class="headerlink" href="#python-shell-windo
440461
</ul>
441462
</div>
442463
<div class="section" id="text-colors">
443-
<h3>25.5.2.4. Text colors<a class="headerlink" href="#text-colors" title="Permalink to this headline"></a></h3>
464+
<h3>25.5.2.5. Text colors<a class="headerlink" href="#text-colors" title="Permalink to this headline"></a></h3>
444465
<p>Idle defaults to black on white text, but colors text with special meanings.
445466
For the shell, these are shell output, shell error, user output, and
446467
user error. For Python code, at the shell prompt or in an editor, these are
@@ -595,8 +616,9 @@ <h3><a href="../contents.html">Table Of Contents</a></h3>
595616
<li><a class="reference internal" href="#editing-and-navigation">25.5.2. Editing and navigation</a><ul>
596617
<li><a class="reference internal" href="#automatic-indentation">25.5.2.1. Automatic indentation</a></li>
597618
<li><a class="reference internal" href="#completions">25.5.2.2. Completions</a></li>
598-
<li><a class="reference internal" href="#python-shell-window">25.5.2.3. Python Shell window</a></li>
599-
<li><a class="reference internal" href="#text-colors">25.5.2.4. Text colors</a></li>
619+
<li><a class="reference internal" href="#calltips">25.5.2.3. Calltips</a></li>
620+
<li><a class="reference internal" href="#python-shell-window">25.5.2.4. Python Shell window</a></li>
621+
<li><a class="reference internal" href="#text-colors">25.5.2.5. Text colors</a></li>
600622
</ul>
601623
</li>
602624
<li><a class="reference internal" href="#startup-and-code-execution">25.5.3. Startup and code execution</a><ul>
@@ -677,7 +699,7 @@ <h3>Navigation</h3>
677699
The Python Software Foundation is a non-profit corporation.
678700
<a href="https://www.python.org/psf/donations/">Please donate.</a>
679701
<br />
680-
Last updated on Sep 24, 2015.
702+
Last updated on Sep 29, 2015.
681703
<a href="../bugs.html">Found a bug</a>?
682704
<br />
683705
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.3.

0 commit comments

Comments
 (0)