mirror of https://github.com/python/cpython
gh-82006: IDLE doc improvements (#94349)
0. Update text start and stop conditions. 1. Title-case sections but not subsections. 2. Edit Shell Window sections: title, execute, restart.
This commit is contained in:
parent
edb10cab39
commit
e6391e08bf
|
@ -357,7 +357,7 @@ for more on Help menu choices.
|
|||
single: Clear Breakpoint
|
||||
single: breakpoints
|
||||
|
||||
Context Menus
|
||||
Context menus
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Open a context menu by right-clicking in a window (Control-click on macOS).
|
||||
|
@ -398,7 +398,7 @@ Squeeze
|
|||
|
||||
.. _editing-and-navigation:
|
||||
|
||||
Editing and navigation
|
||||
Editing and Navigation
|
||||
----------------------
|
||||
|
||||
Editor windows
|
||||
|
@ -576,17 +576,29 @@ line to the top of the editor.
|
|||
The text and background colors for the context pane can be configured under
|
||||
the Highlights tab in the Configure IDLE dialog.
|
||||
|
||||
Python Shell window
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
Shell window
|
||||
^^^^^^^^^^^^
|
||||
|
||||
With IDLE's Shell, one enters, edits, and recalls complete statements.
|
||||
Most consoles and terminals only work with a single physical line at a time.
|
||||
In IDLE's Shell, enter, edit, and recall complete statements. (Most
|
||||
consoles and terminals only work with a single physical line at a time).
|
||||
|
||||
Submit a single-line statement for execution by hitting :kbd:`Return`
|
||||
with the cursor anywhere on the line. If a line is extended with
|
||||
Backslash (:kbd:`\\`), the cursor must be on the last physical line.
|
||||
Submit a multi-line compound statement by entering a blank line after
|
||||
the statement.
|
||||
|
||||
When one pastes code into Shell, it is not compiled and possibly executed
|
||||
until one hits :kbd:`Return`. One may edit pasted code first.
|
||||
If one pastes more that one statement into Shell, the result will be a
|
||||
until one hits :kbd:`Return`, as specified above.
|
||||
One may edit pasted code first.
|
||||
If one pastes more than one statement into Shell, the result will be a
|
||||
:exc:`SyntaxError` when multiple statements are compiled as if they were one.
|
||||
|
||||
Lines containing`'RESTART'` mean that the user execution process has been
|
||||
re-started. This occurs when the user execution process has crashed,
|
||||
when one requests a restart on the Shell menu, or when one runs code
|
||||
in an editor window.
|
||||
|
||||
The editing features described in previous subsections work when entering
|
||||
code interactively. IDLE's Shell window also responds to the following keys.
|
||||
|
||||
|
@ -603,7 +615,8 @@ code interactively. IDLE's Shell window also responds to the following keys.
|
|||
|
||||
* :kbd:`Alt-n` retrieves next. On macOS use :kbd:`C-n`.
|
||||
|
||||
* :kbd:`Return` while on any previous command retrieves that command
|
||||
* :kbd:`Return` while the cursor is on any previous command
|
||||
retrieves that command
|
||||
|
||||
Text colors
|
||||
^^^^^^^^^^^
|
||||
|
@ -627,7 +640,7 @@ Highlighting tab. The marking of debugger breakpoint lines in the editor and
|
|||
text in popups and dialogs is not user-configurable.
|
||||
|
||||
|
||||
Startup and code execution
|
||||
Startup and Code Execution
|
||||
--------------------------
|
||||
|
||||
Upon startup with the ``-s`` option, IDLE will execute the file referenced by
|
||||
|
@ -894,7 +907,7 @@ with the default subprocess if at all possible.
|
|||
.. deprecated:: 3.4
|
||||
|
||||
|
||||
Help and preferences
|
||||
Help and Preferences
|
||||
--------------------
|
||||
|
||||
.. _help-sources:
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>IDLE — Python 3.11.0a4 documentation</title>
|
||||
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
|
||||
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
|
||||
<title>IDLE — Python 3.12.0a0 documentation</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../_static/pydoctheme.css?2022.1" />
|
||||
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<script src="../_static/language_data.js"></script>
|
||||
|
||||
<script src="../_static/sidebar.js"></script>
|
||||
|
||||
<link rel="search" type="application/opensearchdescription+xml"
|
||||
title="Search within Python 3.11.0a4 documentation"
|
||||
title="Search within Python 3.12.0a0 documentation"
|
||||
href="../_static/opensearch.xml"/>
|
||||
<link rel="author" title="About these documents" href="../about.html" />
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
@ -39,16 +41,110 @@
|
|||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="../_static/py.svg" />
|
||||
<script type="text/javascript" src="../_static/copybutton.js"></script>
|
||||
<script type="text/javascript" src="../_static/menu.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="mobile-nav">
|
||||
<input type="checkbox" id="menuToggler" class="toggler__input" aria-controls="navigation"
|
||||
aria-pressed="false" aria-expanded="false" role="button" aria-label="Menu" />
|
||||
<label for="menuToggler" class="toggler__label">
|
||||
<span></span>
|
||||
</label>
|
||||
<nav class="nav-content" role="navigation">
|
||||
<a href="https://www.python.org/" class="nav-logo">
|
||||
<img src="../_static/py.svg" alt="Logo"/>
|
||||
</a>
|
||||
<div class="version_switcher_placeholder"></div>
|
||||
<form role="search" class="search" action="../search.html" method="get">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" class="search-icon">
|
||||
<path fill-rule="nonzero"
|
||||
d="M15.5 14h-.79l-.28-.27a6.5 6.5 0 001.48-5.34c-.47-2.78-2.79-5-5.59-5.34a6.505 6.505 0 00-7.27 7.27c.34 2.8 2.56 5.12 5.34 5.59a6.5 6.5 0 005.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0 .41-.41.41-1.08 0-1.49L15.5 14zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z" fill="#444"></path>
|
||||
</svg>
|
||||
<input type="text" name="q" aria-label="Quick search"/>
|
||||
<input type="submit" value="Go"/>
|
||||
</form>
|
||||
</nav>
|
||||
<div class="menu-wrapper">
|
||||
<nav class="menu" role="navigation" aria-label="main navigation">
|
||||
<div class="language_switcher_placeholder"></div>
|
||||
<div>
|
||||
<h3><a href="../contents.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">IDLE</a><ul>
|
||||
<li><a class="reference internal" href="#menus">Menus</a><ul>
|
||||
<li><a class="reference internal" href="#file-menu-shell-and-editor">File menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#edit-menu-shell-and-editor">Edit menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#format-menu-editor-window-only">Format menu (Editor window only)</a></li>
|
||||
<li><a class="reference internal" href="#run-menu-editor-window-only">Run menu (Editor window only)</a></li>
|
||||
<li><a class="reference internal" href="#shell-menu-shell-window-only">Shell menu (Shell window only)</a></li>
|
||||
<li><a class="reference internal" href="#debug-menu-shell-window-only">Debug menu (Shell window only)</a></li>
|
||||
<li><a class="reference internal" href="#options-menu-shell-and-editor">Options menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#window-menu-shell-and-editor">Window menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#help-menu-shell-and-editor">Help menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#context-menus">Context menus</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#editing-and-navigation">Editing and Navigation</a><ul>
|
||||
<li><a class="reference internal" href="#editor-windows">Editor windows</a></li>
|
||||
<li><a class="reference internal" href="#key-bindings">Key bindings</a></li>
|
||||
<li><a class="reference internal" href="#automatic-indentation">Automatic indentation</a></li>
|
||||
<li><a class="reference internal" href="#completions">Completions</a></li>
|
||||
<li><a class="reference internal" href="#calltips">Calltips</a></li>
|
||||
<li><a class="reference internal" href="#code-context">Code Context</a></li>
|
||||
<li><a class="reference internal" href="#shell-window">Shell window</a></li>
|
||||
<li><a class="reference internal" href="#text-colors">Text colors</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#startup-and-code-execution">Startup and Code Execution</a><ul>
|
||||
<li><a class="reference internal" href="#command-line-usage">Command line usage</a></li>
|
||||
<li><a class="reference internal" href="#startup-failure">Startup failure</a></li>
|
||||
<li><a class="reference internal" href="#running-user-code">Running user code</a></li>
|
||||
<li><a class="reference internal" href="#user-output-in-shell">User output in Shell</a></li>
|
||||
<li><a class="reference internal" href="#developing-tkinter-applications">Developing tkinter applications</a></li>
|
||||
<li><a class="reference internal" href="#running-without-a-subprocess">Running without a subprocess</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#help-and-preferences">Help and Preferences</a><ul>
|
||||
<li><a class="reference internal" href="#help-sources">Help sources</a></li>
|
||||
<li><a class="reference internal" href="#setting-preferences">Setting preferences</a></li>
|
||||
<li><a class="reference internal" href="#idle-on-macos">IDLE on macOS</a></li>
|
||||
<li><a class="reference internal" href="#extensions">Extensions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="tkinter.tix.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter.tix</span></code> — Extension widgets for Tk</a></p>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="development.html"
|
||||
title="next chapter">Development Tools</a></p>
|
||||
</div>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="../bugs.html">Report a Bug</a></li>
|
||||
<li>
|
||||
<a href="https://github.com/python/cpython/blob/main/Doc/library/idle.rst"
|
||||
rel="nofollow">Show Source
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</head><body>
|
||||
|
||||
<div class="related" role="navigation" aria-label="related navigation">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
|
@ -65,13 +161,17 @@
|
|||
<a href="tkinter.tix.html" title="tkinter.tix — Extension widgets for Tk"
|
||||
accesskey="P">previous</a> |</li>
|
||||
|
||||
<li><img src="../_static/py.png" alt=""
|
||||
style="vertical-align: middle; margin-top: -1px"/></li>
|
||||
<li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||||
<li class="switchers">
|
||||
<div class="language_switcher_placeholder"></div>
|
||||
<div class="version_switcher_placeholder"></div>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
|
||||
</li>
|
||||
<li id="cpython-language-and-version">
|
||||
<a href="../index.html">3.11.0a4 Documentation</a> »
|
||||
<a href="../index.html">3.12.0a0 Documentation</a> »
|
||||
</li>
|
||||
|
||||
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
|
||||
|
@ -80,15 +180,14 @@
|
|||
<li class="right">
|
||||
|
||||
|
||||
<div class="inline-search" style="display: none" role="search">
|
||||
<div class="inline-search" role="search">
|
||||
<form class="inline-search" action="../search.html" method="get">
|
||||
<input placeholder="Quick search" type="text" name="q" />
|
||||
<input placeholder="Quick search" aria-label="Quick search" type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">$('.inline-search').show(0);</script>
|
||||
|
|
||||
</li>
|
||||
|
||||
|
@ -100,8 +199,8 @@
|
|||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<div class="section" id="idle">
|
||||
<span id="id1"></span><h1>IDLE<a class="headerlink" href="#idle" title="Permalink to this headline">¶</a></h1>
|
||||
<section id="idle">
|
||||
<span id="id1"></span><h1>IDLE<a class="headerlink" href="#idle" title="Permalink to this heading">¶</a></h1>
|
||||
<p><strong>Source code:</strong> <a class="reference external" href="https://github.com/python/cpython/tree/main/Lib/idlelib/">Lib/idlelib/</a></p>
|
||||
<hr class="docutils" id="index-0" />
|
||||
<p>IDLE is Python’s Integrated Development and Learning Environment.</p>
|
||||
|
@ -119,8 +218,8 @@ through multiple files (grep)</p></li>
|
|||
of global and local namespaces</p></li>
|
||||
<li><p>configuration, browsers, and other dialogs</p></li>
|
||||
</ul>
|
||||
<div class="section" id="menus">
|
||||
<h2>Menus<a class="headerlink" href="#menus" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="menus">
|
||||
<h2>Menus<a class="headerlink" href="#menus" title="Permalink to this heading">¶</a></h2>
|
||||
<p>IDLE has two main window types, the Shell window and the Editor window. It is
|
||||
possible to have multiple editor windows simultaneously. On Windows and
|
||||
Linux, each has its own top menu. Each menu documented below indicates
|
||||
|
@ -131,8 +230,8 @@ default title and context menu.</p>
|
|||
<p>On macOS, there is one application menu. It dynamically changes according
|
||||
to the window currently selected. It has an IDLE menu, and some entries
|
||||
described below are moved around to conform to Apple guidelines.</p>
|
||||
<div class="section" id="file-menu-shell-and-editor">
|
||||
<h3>File menu (Shell and Editor)<a class="headerlink" href="#file-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
|
||||
<section id="file-menu-shell-and-editor">
|
||||
<h3>File menu (Shell and Editor)<a class="headerlink" href="#file-menu-shell-and-editor" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>New File</dt><dd><p>Create a new file editing window.</p>
|
||||
</dd>
|
||||
|
@ -170,9 +269,9 @@ window also closes Shell. If this is the only window, also exit IDLE.</p>
|
|||
<dt>Exit IDLE</dt><dd><p>Close all windows and quit IDLE (ask to save unsaved edit windows).</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="edit-menu-shell-and-editor">
|
||||
<h3>Edit menu (Shell and Editor)<a class="headerlink" href="#edit-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="edit-menu-shell-and-editor">
|
||||
<h3>Edit menu (Shell and Editor)<a class="headerlink" href="#edit-menu-shell-and-editor" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>Undo</dt><dd><p>Undo the last change to the current window. A maximum of 1000 changes may
|
||||
be undone.</p>
|
||||
|
@ -217,9 +316,9 @@ Editing and navigation section below.</p>
|
|||
<dt>Show surrounding parens</dt><dd><p>Highlight the surrounding parenthesis.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="format-menu-editor-window-only">
|
||||
<span id="format-menu"></span><h3>Format menu (Editor window only)<a class="headerlink" href="#format-menu-editor-window-only" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="format-menu-editor-window-only">
|
||||
<span id="format-menu"></span><h3>Format menu (Editor window only)<a class="headerlink" href="#format-menu-editor-window-only" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>Indent Region</dt><dd><p>Shift selected lines right by the indent width (default 4 spaces).</p>
|
||||
</dd>
|
||||
|
@ -249,9 +348,9 @@ including lines within multiline strings. Except for Shell windows,
|
|||
remove extra newlines at the end of the file.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="run-menu-editor-window-only">
|
||||
<span id="index-2"></span><h3>Run menu (Editor window only)<a class="headerlink" href="#run-menu-editor-window-only" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="run-menu-editor-window-only">
|
||||
<span id="index-2"></span><h3>Run menu (Editor window only)<a class="headerlink" href="#run-menu-editor-window-only" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple" id="run-module">
|
||||
<dt>Run Module</dt><dd><p>Do <a class="reference internal" href="#check-module"><span class="std std-ref">Check Module</span></a>. If no error, restart the shell to clean the
|
||||
environment, then execute the module. Output is displayed in the Shell
|
||||
|
@ -280,9 +379,9 @@ Editor window.</p>
|
|||
<dt>Python Shell</dt><dd><p>Open or wake up the Python Shell window.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="shell-menu-shell-window-only">
|
||||
<h3>Shell menu (Shell window only)<a class="headerlink" href="#shell-menu-shell-window-only" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="shell-menu-shell-window-only">
|
||||
<h3>Shell menu (Shell window only)<a class="headerlink" href="#shell-menu-shell-window-only" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>View Last Restart</dt><dd><p>Scroll the shell window to the last Shell restart.</p>
|
||||
</dd>
|
||||
|
@ -295,9 +394,9 @@ Editor window.</p>
|
|||
<dt>Interrupt Execution</dt><dd><p>Stop a running program.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="debug-menu-shell-window-only">
|
||||
<h3>Debug menu (Shell window only)<a class="headerlink" href="#debug-menu-shell-window-only" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="debug-menu-shell-window-only">
|
||||
<h3>Debug menu (Shell window only)<a class="headerlink" href="#debug-menu-shell-window-only" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>Go to File/Line</dt><dd><p>Look on the current line. with the cursor, and the line above for a filename
|
||||
and line number. If found, open the file if not already open, and show the
|
||||
|
@ -317,9 +416,9 @@ access to locals and globals.</p>
|
|||
<dt>Auto-open Stack Viewer</dt><dd><p>Toggle automatically opening the stack viewer on an unhandled exception.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="options-menu-shell-and-editor">
|
||||
<h3>Options menu (Shell and Editor)<a class="headerlink" href="#options-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="options-menu-shell-and-editor">
|
||||
<h3>Options menu (Shell and Editor)<a class="headerlink" href="#options-menu-shell-and-editor" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>Configure IDLE</dt><dd><p>Open a configuration dialog and change preferences for the following:
|
||||
fonts, indentation, keybindings, text color themes, startup windows and
|
||||
|
@ -349,14 +448,14 @@ Changing screen settings may invalidate the saved height. This toggle has
|
|||
no effect when a window is maximized.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="section" id="window-menu-shell-and-editor">
|
||||
<h3>Window menu (Shell and Editor)<a class="headerlink" href="#window-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="window-menu-shell-and-editor">
|
||||
<h3>Window menu (Shell and Editor)<a class="headerlink" href="#window-menu-shell-and-editor" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Lists the names of all open windows; select one to bring it to the foreground
|
||||
(deiconifying it if necessary).</p>
|
||||
</div>
|
||||
<div class="section" id="help-menu-shell-and-editor">
|
||||
<h3>Help menu (Shell and Editor)<a class="headerlink" href="#help-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="help-menu-shell-and-editor">
|
||||
<h3>Help menu (Shell and Editor)<a class="headerlink" href="#help-menu-shell-and-editor" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="simple">
|
||||
<dt>About IDLE</dt><dd><p>Display version, copyright, license, credits, and more.</p>
|
||||
</dd>
|
||||
|
@ -372,9 +471,9 @@ and open docs.python.org showing the latest Python documentation.</p>
|
|||
<p>Additional help sources may be added here with the Configure IDLE dialog under
|
||||
the General tab. See the <a class="reference internal" href="#help-sources"><span class="std std-ref">Help sources</span></a> subsection below
|
||||
for more on Help menu choices.</p>
|
||||
</div>
|
||||
<div class="section" id="context-menus">
|
||||
<span id="index-4"></span><h3>Context Menus<a class="headerlink" href="#context-menus" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="context-menus">
|
||||
<span id="index-4"></span><h3>Context menus<a class="headerlink" href="#context-menus" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Open a context menu by right-clicking in a window (Control-click on macOS).
|
||||
Context menus have the standard clipboard functions also on the Edit menu.</p>
|
||||
<dl class="simple">
|
||||
|
@ -407,12 +506,12 @@ Shell window</em> subsection below.</p>
|
|||
the code above and the prompt below down to a ‘Squeezed text’ label.</p>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="editing-and-navigation">
|
||||
<span id="id2"></span><h2>Editing and navigation<a class="headerlink" href="#editing-and-navigation" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="editor-windows">
|
||||
<h3>Editor windows<a class="headerlink" href="#editor-windows" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
</section>
|
||||
<section id="editing-and-navigation">
|
||||
<span id="id2"></span><h2>Editing and Navigation<a class="headerlink" href="#editing-and-navigation" title="Permalink to this heading">¶</a></h2>
|
||||
<section id="editor-windows">
|
||||
<h3>Editor windows<a class="headerlink" href="#editor-windows" title="Permalink to this heading">¶</a></h3>
|
||||
<p>IDLE may open editor windows when it starts, depending on settings
|
||||
and how you start IDLE. Thereafter, use the File menu. There can be only
|
||||
one open editor window for a given file.</p>
|
||||
|
@ -422,41 +521,41 @@ number (‘Ln’) and column number (‘Col’). Line numbers start with 1;
|
|||
column numbers with 0.</p>
|
||||
<p>IDLE assumes that files with a known .py* extension contain Python code
|
||||
and that other files do not. Run Python code with the Run menu.</p>
|
||||
</div>
|
||||
<div class="section" id="key-bindings">
|
||||
<h3>Key bindings<a class="headerlink" href="#key-bindings" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="key-bindings">
|
||||
<h3>Key bindings<a class="headerlink" href="#key-bindings" title="Permalink to this heading">¶</a></h3>
|
||||
<p>In this section, ‘C’ refers to the <kbd class="kbd docutils literal notranslate">Control</kbd> key on Windows and Unix and
|
||||
the <kbd class="kbd docutils literal notranslate">Command</kbd> key on macOS.</p>
|
||||
<ul>
|
||||
<li><p><kbd class="kbd docutils literal notranslate">Backspace</kbd> deletes to the left; <kbd class="kbd docutils literal notranslate">Del</kbd> deletes to the right</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Backspace</kbd></kbd> delete word left; <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Del</kbd></kbd> delete word to the right</p></li>
|
||||
<li><p>Arrow keys and <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Page</kbd> <kbd class="kbd docutils literal notranslate">Up</kbd></kbd>/<kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Page</kbd> <kbd class="kbd docutils literal notranslate">Down</kbd></kbd> to move around</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">LeftArrow</kbd></kbd> and <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">RightArrow</kbd></kbd> moves by words</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Backspace</kbd></kbd> delete word left; <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Del</kbd></kbd> delete word to the right</p></li>
|
||||
<li><p>Arrow keys and <kbd class="kbd docutils literal notranslate">Page Up</kbd>/<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Page</kbd> <kbd class="kbd docutils literal notranslate">Down</kbd></kbd> to move around</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">LeftArrow</kbd></kbd> and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">RightArrow</kbd></kbd> moves by words</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate">Home</kbd>/<kbd class="kbd docutils literal notranslate">End</kbd> go to begin/end of line</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Home</kbd></kbd>/<kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">End</kbd></kbd> go to begin/end of file</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">Home</kbd></kbd>/<kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">End</kbd></kbd> go to begin/end of file</p></li>
|
||||
<li><p>Some useful Emacs bindings are inherited from Tcl/Tk:</p>
|
||||
<blockquote>
|
||||
<div><ul class="simple">
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">a</kbd></kbd> beginning of line</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">e</kbd></kbd> end of line</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">k</kbd></kbd> kill line (but doesn’t put it in clipboard)</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">l</kbd></kbd> center window around the insertion point</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">b</kbd></kbd> go backward one character without deleting (usually you can
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">a</kbd></kbd> beginning of line</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">e</kbd></kbd> end of line</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">k</kbd></kbd> kill line (but doesn’t put it in clipboard)</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">l</kbd></kbd> center window around the insertion point</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">b</kbd></kbd> go backward one character without deleting (usually you can
|
||||
also use the cursor key for this)</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">f</kbd></kbd> go forward one character without deleting (usually you can
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">f</kbd></kbd> go forward one character without deleting (usually you can
|
||||
also use the cursor key for this)</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> go up one line (usually you can also use the cursor key for
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> go up one line (usually you can also use the cursor key for
|
||||
this)</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> delete next character</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> delete next character</p></li>
|
||||
</ul>
|
||||
</div></blockquote>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Standard keybindings (like <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> to copy and <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">v</kbd></kbd> to paste)
|
||||
<p>Standard keybindings (like <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> to copy and <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">v</kbd></kbd> to paste)
|
||||
may work. Keybindings are selected in the Configure IDLE dialog.</p>
|
||||
</div>
|
||||
<div class="section" id="automatic-indentation">
|
||||
<h3>Automatic indentation<a class="headerlink" href="#automatic-indentation" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="automatic-indentation">
|
||||
<h3>Automatic indentation<a class="headerlink" href="#automatic-indentation" title="Permalink to this heading">¶</a></h3>
|
||||
<p>After a block-opening statement, the next line is indented by 4 spaces (in the
|
||||
Python Shell window by one tab). After certain keywords (break, return etc.)
|
||||
the next line is dedented. In leading indentation, <kbd class="kbd docutils literal notranslate">Backspace</kbd> deletes up
|
||||
|
@ -465,9 +564,9 @@ Shell window one tab), number depends on Indent width. Currently, tabs
|
|||
are restricted to four spaces due to Tcl/Tk limitations.</p>
|
||||
<p>See also the indent/dedent region commands on the
|
||||
<a class="reference internal" href="#format-menu"><span class="std std-ref">Format menu</span></a>.</p>
|
||||
</div>
|
||||
<div class="section" id="completions">
|
||||
<span id="id3"></span><h3>Completions<a class="headerlink" href="#completions" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="completions">
|
||||
<span id="id3"></span><h3>Completions<a class="headerlink" href="#completions" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Completions are supplied, when requested and available, for module
|
||||
names, attributes of classes or functions, or filenames. Each request
|
||||
method displays a completion box with existing names. (See tab
|
||||
|
@ -489,7 +588,7 @@ one can specify a drive first.) Move into subdirectories by typing a
|
|||
directory name and a separator.</p>
|
||||
<p>Instead of waiting, or after a box is closed, open a completion box
|
||||
immediately with Show Completions on the Edit menu. The default hot
|
||||
key is <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">space</kbd></kbd>. If one types a prefix for the desired name
|
||||
key is <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">space</kbd></kbd>. If one types a prefix for the desired name
|
||||
before opening the box, the first match or near miss is made visible.
|
||||
The result is the same as if one enters a prefix
|
||||
after the box is displayed. Show Completions after a quote completes
|
||||
|
@ -509,9 +608,9 @@ possible attribute completions.</p>
|
|||
<p>Completion boxes initially exclude names beginning with ‘_’ or, for
|
||||
modules, not included in ‘__all__’. The hidden names can be accessed
|
||||
by typing ‘_’ after ‘.’, either before or after the box is opened.</p>
|
||||
</div>
|
||||
<div class="section" id="calltips">
|
||||
<span id="id4"></span><h3>Calltips<a class="headerlink" href="#calltips" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="calltips">
|
||||
<span id="id4"></span><h3>Calltips<a class="headerlink" href="#calltips" title="Permalink to this heading">¶</a></h3>
|
||||
<p>A calltip is shown automatically when one types <kbd class="kbd docutils literal notranslate">(</kbd> after the name
|
||||
of an <em>accessible</em> function. A function name expression may include
|
||||
dots and subscripts. A calltip remains until it is clicked, the cursor
|
||||
|
@ -535,9 +634,9 @@ will display a calltip.</p>
|
|||
<p>In an editor, import statements have no effect until one runs the file.
|
||||
One might want to run a file after writing import statements, after
|
||||
adding function definitions, or after opening an existing file.</p>
|
||||
</div>
|
||||
<div class="section" id="code-context">
|
||||
<span id="id5"></span><h3>Code Context<a class="headerlink" href="#code-context" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="code-context">
|
||||
<span id="id5"></span><h3>Code Context<a class="headerlink" href="#code-context" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Within an editor window containing Python code, code context can be toggled
|
||||
in order to show or hide a pane at the top of the window. When shown, this
|
||||
pane freezes the opening lines for block code, such as those beginning with
|
||||
|
@ -550,33 +649,44 @@ line will display. Clicking on a line in the context pane will move that
|
|||
line to the top of the editor.</p>
|
||||
<p>The text and background colors for the context pane can be configured under
|
||||
the Highlights tab in the Configure IDLE dialog.</p>
|
||||
</div>
|
||||
<div class="section" id="python-shell-window">
|
||||
<h3>Python Shell window<a class="headerlink" href="#python-shell-window" title="Permalink to this headline">¶</a></h3>
|
||||
<p>With IDLE’s Shell, one enters, edits, and recalls complete statements.
|
||||
Most consoles and terminals only work with a single physical line at a time.</p>
|
||||
</section>
|
||||
<section id="shell-window">
|
||||
<h3>Shell window<a class="headerlink" href="#shell-window" title="Permalink to this heading">¶</a></h3>
|
||||
<p>In IDLE’s Shell, enter, edit, and recall complete statements. (Most
|
||||
consoles and terminals only work with a single physical line at a time).</p>
|
||||
<p>Submit a single-line statement for execution by hitting <kbd class="kbd docutils literal notranslate">Return</kbd>
|
||||
with the cursor anywhere on the line. If a line is extended with
|
||||
Backslash (<kbd class="kbd docutils literal notranslate">\</kbd>), the cursor must be on the last physical line.
|
||||
Submit a multi-line compound statement by entering a blank line after
|
||||
the statement.</p>
|
||||
<p>When one pastes code into Shell, it is not compiled and possibly executed
|
||||
until one hits <kbd class="kbd docutils literal notranslate">Return</kbd>. One may edit pasted code first.
|
||||
If one pastes more that one statement into Shell, the result will be a
|
||||
until one hits <kbd class="kbd docutils literal notranslate">Return</kbd>, as specified above.
|
||||
One may edit pasted code first.
|
||||
If one pastes more than one statement into Shell, the result will be a
|
||||
<a class="reference internal" href="exceptions.html#SyntaxError" title="SyntaxError"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SyntaxError</span></code></a> when multiple statements are compiled as if they were one.</p>
|
||||
<p>Lines containing`’RESTART’` mean that the user execution process has been
|
||||
re-started. This occurs when the user execution process has crashed,
|
||||
when one requests a restart on the Shell menu, or when one runs code
|
||||
in an editor window.</p>
|
||||
<p>The editing features described in previous subsections work when entering
|
||||
code interactively. IDLE’s Shell window also responds to the following keys.</p>
|
||||
<ul>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> interrupts executing command</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> sends end-of-file; closes window if typed at a <code class="docutils literal notranslate"><span class="pre">>>></span></code> prompt</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">/</kbd></kbd> (Expand word) is also useful to reduce typing</p>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">c</kbd></kbd> interrupts executing command</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">d</kbd></kbd> sends end-of-file; closes window if typed at a <code class="docutils literal notranslate"><span class="pre">>>></span></code> prompt</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">/</kbd></kbd> (Expand word) is also useful to reduce typing</p>
|
||||
<p>Command history</p>
|
||||
<ul class="simple">
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> retrieves previous command matching what you have typed. On
|
||||
macOS use <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd>.</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> retrieves next. On macOS use <kbd class="kbd docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd>.</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate">Return</kbd> while on any previous command retrieves that command</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd> retrieves previous command matching what you have typed. On
|
||||
macOS use <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">p</kbd></kbd>.</p></li>
|
||||
<li><p><kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">Alt</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd> retrieves next. On macOS use <kbd class="kbd compound docutils literal notranslate"><kbd class="kbd docutils literal notranslate">C</kbd>-<kbd class="kbd docutils literal notranslate">n</kbd></kbd>.</p></li>
|
||||
<li><p><kbd class="kbd docutils literal notranslate">Return</kbd> while the cursor is on any previous command
|
||||
retrieves that command</p></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="text-colors">
|
||||
<h3>Text colors<a class="headerlink" href="#text-colors" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="text-colors">
|
||||
<h3>Text colors<a class="headerlink" href="#text-colors" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Idle defaults to black on white text, but colors text with special meanings.
|
||||
For the shell, these are shell output, shell error, user output, and
|
||||
user error. For Python code, at the shell prompt or in an editor, these are
|
||||
|
@ -592,10 +702,10 @@ patterns.</p>
|
|||
visible. To change the color scheme, use the Configure IDLE dialog
|
||||
Highlighting tab. The marking of debugger breakpoint lines in the editor and
|
||||
text in popups and dialogs is not user-configurable.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="startup-and-code-execution">
|
||||
<h2>Startup and code execution<a class="headerlink" href="#startup-and-code-execution" title="Permalink to this headline">¶</a></h2>
|
||||
</section>
|
||||
</section>
|
||||
<section id="startup-and-code-execution">
|
||||
<h2>Startup and Code Execution<a class="headerlink" href="#startup-and-code-execution" title="Permalink to this heading">¶</a></h2>
|
||||
<p>Upon startup with the <code class="docutils literal notranslate"><span class="pre">-s</span></code> option, IDLE will execute the file referenced by
|
||||
the environment variables <span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal notranslate"><span class="pre">IDLESTARTUP</span></code> or <span class="target" id="index-6"></span><a class="reference internal" href="../using/cmdline.html#envvar-PYTHONSTARTUP"><code class="xref std std-envvar docutils literal notranslate"><span class="pre">PYTHONSTARTUP</span></code></a>.
|
||||
IDLE first checks for <code class="docutils literal notranslate"><span class="pre">IDLESTARTUP</span></code>; if <code class="docutils literal notranslate"><span class="pre">IDLESTARTUP</span></code> is present the file
|
||||
|
@ -608,8 +718,8 @@ Tk file is loaded unconditionally. This additional file is <code class="docutil
|
|||
looked for in the user’s home directory. Statements in this file will be
|
||||
executed in the Tk namespace, so this file is not useful for importing
|
||||
functions to be used from IDLE’s Python shell.</p>
|
||||
<div class="section" id="command-line-usage">
|
||||
<h3>Command line usage<a class="headerlink" href="#command-line-usage" title="Permalink to this headline">¶</a></h3>
|
||||
<section id="command-line-usage">
|
||||
<h3>Command line usage<a class="headerlink" href="#command-line-usage" title="Permalink to this heading">¶</a></h3>
|
||||
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ...
|
||||
|
||||
-c command run command in the shell window
|
||||
|
@ -632,9 +742,9 @@ set in the Options dialog.</p></li>
|
|||
<li><p>Otherwise, arguments are files opened for editing and
|
||||
<code class="docutils literal notranslate"><span class="pre">sys.argv</span></code> reflects the arguments passed to IDLE itself.</p></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="startup-failure">
|
||||
<h3>Startup failure<a class="headerlink" href="#startup-failure" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="startup-failure">
|
||||
<h3>Startup failure<a class="headerlink" href="#startup-failure" title="Permalink to this heading">¶</a></h3>
|
||||
<p>IDLE uses a socket to communicate between the IDLE GUI process and the user
|
||||
code execution process. A connection must be established whenever the Shell
|
||||
starts or restarts. (The latter is indicated by a divider line that says
|
||||
|
@ -684,9 +794,9 @@ a tk failure with a message to the terminal. This can happen either
|
|||
if one starts IDLE to edit a file with such a character or later
|
||||
when entering such a character. If one cannot upgrade tcl/tk,
|
||||
then re-configure IDLE to use a font that works better.</p>
|
||||
</div>
|
||||
<div class="section" id="running-user-code">
|
||||
<h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="running-user-code">
|
||||
<h3>Running user code<a class="headerlink" href="#running-user-code" title="Permalink to this heading">¶</a></h3>
|
||||
<p>With rare exceptions, the result of executing Python code with IDLE is
|
||||
intended to be the same as executing the same code by the default method,
|
||||
directly with Python in a text-mode system console or terminal window.
|
||||
|
@ -726,9 +836,9 @@ that would not be there otherwise. IDLE wraps <code class="docutils literal not
|
|||
frames.</p>
|
||||
<p>When user code raises SystemExit either directly or by calling sys.exit,
|
||||
IDLE returns to a Shell prompt instead of exiting.</p>
|
||||
</div>
|
||||
<div class="section" id="user-output-in-shell">
|
||||
<h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="user-output-in-shell">
|
||||
<h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title="Permalink to this heading">¶</a></h3>
|
||||
<p>When a program outputs text, the result is determined by the
|
||||
corresponding output device. When IDLE executes user code, <code class="docutils literal notranslate"><span class="pre">sys.stdout</span></code>
|
||||
and <code class="docutils literal notranslate"><span class="pre">sys.stderr</span></code> are connected to the display area of IDLE’s Shell. Some of
|
||||
|
@ -780,9 +890,9 @@ down scrolling.</p>
|
|||
<p>Squeezed output is expanded in place by double-clicking the label.
|
||||
It can also be sent to the clipboard or a separate view window by
|
||||
right-clicking the label.</p>
|
||||
</div>
|
||||
<div class="section" id="developing-tkinter-applications">
|
||||
<h3>Developing tkinter applications<a class="headerlink" href="#developing-tkinter-applications" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="developing-tkinter-applications">
|
||||
<h3>Developing tkinter applications<a class="headerlink" href="#developing-tkinter-applications" title="Permalink to this heading">¶</a></h3>
|
||||
<p>IDLE is intentionally different from standard Python in order to
|
||||
facilitate development of tkinter programs. Enter <code class="docutils literal notranslate"><span class="pre">import</span> <span class="pre">tkinter</span> <span class="pre">as</span> <span class="pre">tk;</span>
|
||||
<span class="pre">root</span> <span class="pre">=</span> <span class="pre">tk.Tk()</span></code> in standard Python and nothing appears. Enter the same
|
||||
|
@ -800,9 +910,9 @@ to interact with.</p>
|
|||
the mainloop call. One then gets a shell prompt immediately and can
|
||||
interact with the live application. One just has to remember to
|
||||
re-enable the mainloop call when running in standard Python.</p>
|
||||
</div>
|
||||
<div class="section" id="running-without-a-subprocess">
|
||||
<h3>Running without a subprocess<a class="headerlink" href="#running-without-a-subprocess" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="running-without-a-subprocess">
|
||||
<h3>Running without a subprocess<a class="headerlink" href="#running-without-a-subprocess" title="Permalink to this heading">¶</a></h3>
|
||||
<p>By default, IDLE executes user code in a separate subprocess via a socket,
|
||||
which uses the internal loopback interface. This connection is not
|
||||
externally visible and no data is sent to or received from the internet.
|
||||
|
@ -825,12 +935,12 @@ with the default subprocess if at all possible.</p>
|
|||
<div class="deprecated">
|
||||
<p><span class="versionmodified deprecated">Deprecated since version 3.4.</span></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="help-and-preferences">
|
||||
<h2>Help and preferences<a class="headerlink" href="#help-and-preferences" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="section" id="help-sources">
|
||||
<span id="id6"></span><h3>Help sources<a class="headerlink" href="#help-sources" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
</section>
|
||||
<section id="help-and-preferences">
|
||||
<h2>Help and Preferences<a class="headerlink" href="#help-and-preferences" title="Permalink to this heading">¶</a></h2>
|
||||
<section id="help-sources">
|
||||
<span id="id6"></span><h3>Help sources<a class="headerlink" href="#help-sources" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Help menu entry “IDLE Help” displays a formatted html version of the
|
||||
IDLE chapter of the Library Reference. The result, in a read-only
|
||||
tkinter text window, is close to what one sees in a web browser.
|
||||
|
@ -845,9 +955,9 @@ has an off-line copy of the docs (this may be an installation option),
|
|||
that will be opened instead.</p>
|
||||
<p>Selected URLs can be added or removed from the help menu at any time using the
|
||||
General tab of the Configure IDLE dialog.</p>
|
||||
</div>
|
||||
<div class="section" id="setting-preferences">
|
||||
<span id="preferences"></span><h3>Setting preferences<a class="headerlink" href="#setting-preferences" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="setting-preferences">
|
||||
<span id="preferences"></span><h3>Setting preferences<a class="headerlink" href="#setting-preferences" title="Permalink to this heading">¶</a></h3>
|
||||
<p>The font preferences, highlighting, keys, and general preferences can be
|
||||
changed via Configure IDLE on the Option menu.
|
||||
Non-default user settings are saved in a <code class="docutils literal notranslate"><span class="pre">.idlerc</span></code> directory in the user’s
|
||||
|
@ -863,23 +973,23 @@ and then font.</p>
|
|||
and key set. To use a newer built-in color theme or key set with older
|
||||
IDLEs, save it as a new custom theme or key set and it well be accessible
|
||||
to older IDLEs.</p>
|
||||
</div>
|
||||
<div class="section" id="idle-on-macos">
|
||||
<h3>IDLE on macOS<a class="headerlink" href="#idle-on-macos" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="idle-on-macos">
|
||||
<h3>IDLE on macOS<a class="headerlink" href="#idle-on-macos" title="Permalink to this heading">¶</a></h3>
|
||||
<p>Under System Preferences: Dock, one can set “Prefer tabs when opening
|
||||
documents” to “Always”. This setting is not compatible with the tk/tkinter
|
||||
GUI framework used by IDLE, and it breaks a few IDLE features.</p>
|
||||
</div>
|
||||
<div class="section" id="extensions">
|
||||
<h3>Extensions<a class="headerlink" href="#extensions" title="Permalink to this headline">¶</a></h3>
|
||||
</section>
|
||||
<section id="extensions">
|
||||
<h3>Extensions<a class="headerlink" href="#extensions" title="Permalink to this heading">¶</a></h3>
|
||||
<p>IDLE contains an extension facility. Preferences for extensions can be
|
||||
changed with the Extensions tab of the preferences dialog. See the
|
||||
beginning of config-extensions.def in the idlelib directory for further
|
||||
information. The only current default extension is zzdummy, an example
|
||||
also used for testing.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
<div class="clearer"></div>
|
||||
|
@ -888,6 +998,7 @@ also used for testing.</p>
|
|||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<div>
|
||||
<h3><a href="../contents.html">Table of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">IDLE</a><ul>
|
||||
|
@ -901,21 +1012,21 @@ also used for testing.</p>
|
|||
<li><a class="reference internal" href="#options-menu-shell-and-editor">Options menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#window-menu-shell-and-editor">Window menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#help-menu-shell-and-editor">Help menu (Shell and Editor)</a></li>
|
||||
<li><a class="reference internal" href="#context-menus">Context Menus</a></li>
|
||||
<li><a class="reference internal" href="#context-menus">Context menus</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#editing-and-navigation">Editing and navigation</a><ul>
|
||||
<li><a class="reference internal" href="#editing-and-navigation">Editing and Navigation</a><ul>
|
||||
<li><a class="reference internal" href="#editor-windows">Editor windows</a></li>
|
||||
<li><a class="reference internal" href="#key-bindings">Key bindings</a></li>
|
||||
<li><a class="reference internal" href="#automatic-indentation">Automatic indentation</a></li>
|
||||
<li><a class="reference internal" href="#completions">Completions</a></li>
|
||||
<li><a class="reference internal" href="#calltips">Calltips</a></li>
|
||||
<li><a class="reference internal" href="#code-context">Code Context</a></li>
|
||||
<li><a class="reference internal" href="#python-shell-window">Python Shell window</a></li>
|
||||
<li><a class="reference internal" href="#shell-window">Shell window</a></li>
|
||||
<li><a class="reference internal" href="#text-colors">Text colors</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#startup-and-code-execution">Startup and code execution</a><ul>
|
||||
<li><a class="reference internal" href="#startup-and-code-execution">Startup and Code Execution</a><ul>
|
||||
<li><a class="reference internal" href="#command-line-usage">Command line usage</a></li>
|
||||
<li><a class="reference internal" href="#startup-failure">Startup failure</a></li>
|
||||
<li><a class="reference internal" href="#running-user-code">Running user code</a></li>
|
||||
|
@ -924,7 +1035,7 @@ also used for testing.</p>
|
|||
<li><a class="reference internal" href="#running-without-a-subprocess">Running without a subprocess</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#help-and-preferences">Help and preferences</a><ul>
|
||||
<li><a class="reference internal" href="#help-and-preferences">Help and Preferences</a><ul>
|
||||
<li><a class="reference internal" href="#help-sources">Help sources</a></li>
|
||||
<li><a class="reference internal" href="#setting-preferences">Setting preferences</a></li>
|
||||
<li><a class="reference internal" href="#idle-on-macos">IDLE on macOS</a></li>
|
||||
|
@ -935,12 +1046,17 @@ also used for testing.</p>
|
|||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="tkinter.tix.html"
|
||||
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">tkinter.tix</span></code> — Extension widgets for Tk</a></p>
|
||||
</div>
|
||||
<div>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="development.html"
|
||||
title="next chapter">Development Tools</a></p>
|
||||
</div>
|
||||
<div role="note" aria-label="source link">
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
|
@ -953,6 +1069,10 @@ also used for testing.</p>
|
|||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="sidebarbutton" title="Collapse sidebar">
|
||||
<span>«</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
|
@ -972,13 +1092,17 @@ also used for testing.</p>
|
|||
<a href="tkinter.tix.html" title="tkinter.tix — Extension widgets for Tk"
|
||||
>previous</a> |</li>
|
||||
|
||||
<li><img src="../_static/py.png" alt=""
|
||||
style="vertical-align: middle; margin-top: -1px"/></li>
|
||||
<li><img src="../_static/py.svg" alt="python logo" style="vertical-align: middle; margin-top: -1px"/></li>
|
||||
<li><a href="https://www.python.org/">Python</a> »</li>
|
||||
<li class="switchers">
|
||||
<div class="language_switcher_placeholder"></div>
|
||||
<div class="version_switcher_placeholder"></div>
|
||||
</li>
|
||||
<li>
|
||||
|
||||
|
||||
</li>
|
||||
<li id="cpython-language-and-version">
|
||||
<a href="../index.html">3.11.0a4 Documentation</a> »
|
||||
<a href="../index.html">3.12.0a0 Documentation</a> »
|
||||
</li>
|
||||
|
||||
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> »</li>
|
||||
|
@ -987,15 +1111,14 @@ also used for testing.</p>
|
|||
<li class="right">
|
||||
|
||||
|
||||
<div class="inline-search" style="display: none" role="search">
|
||||
<div class="inline-search" role="search">
|
||||
<form class="inline-search" action="../search.html" method="get">
|
||||
<input placeholder="Quick search" type="text" name="q" />
|
||||
<input placeholder="Quick search" aria-label="Quick search" type="text" name="q" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">$('.inline-search').show(0);</script>
|
||||
|
|
||||
</li>
|
||||
|
||||
|
@ -1004,17 +1127,23 @@ also used for testing.</p>
|
|||
<div class="footer">
|
||||
© <a href="../copyright.html">Copyright</a> 2001-2022, Python Software Foundation.
|
||||
<br />
|
||||
This page is licensed under the Python Software Foundation License Version 2.
|
||||
<br />
|
||||
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
|
||||
<br />
|
||||
See <a href="/license.html">History and License</a> for more information.<br />
|
||||
<br />
|
||||
|
||||
The Python Software Foundation is a non-profit corporation.
|
||||
<a href="https://www.python.org/psf/donations/">Please donate.</a>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
Last updated on Jan 26, 2022.
|
||||
Last updated on Jun 26, 2022.
|
||||
<a href="/bugs.html">Found a bug</a>?
|
||||
<br />
|
||||
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
|
||||
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.0.2.
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
|
|
@ -76,9 +76,9 @@ class HelpParser(HTMLParser):
|
|||
if a == 'class':
|
||||
class_ = v
|
||||
s = ''
|
||||
if tag == 'div' and class_ == 'section':
|
||||
if tag == 'section' and attrs == [('id', 'idle')]:
|
||||
self.show = True # Start main content.
|
||||
elif tag == 'div' and class_ == 'sphinxsidebar':
|
||||
elif tag == 'div' and class_ == 'clearer':
|
||||
self.show = False # End main content.
|
||||
elif tag == 'p' and self.prevtag and not self.prevtag[0]:
|
||||
# Begin a new block for <p> tags after a closed tag.
|
||||
|
|
Loading…
Reference in New Issue