Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../lib64/python2..../idlelib
File: help.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
[0] Fix | Delete
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[1] Fix | Delete
[2] Fix | Delete
[3] Fix | Delete
<html xmlns="http://www.w3.org/1999/xhtml">
[4] Fix | Delete
<head>
[5] Fix | Delete
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
[6] Fix | Delete
[7] Fix | Delete
<title>24.6. IDLE &mdash; Python 2.7.12 documentation</title>
[8] Fix | Delete
[9] Fix | Delete
<link rel="stylesheet" href="../_static/classic.css" type="text/css" />
[10] Fix | Delete
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
[11] Fix | Delete
[12] Fix | Delete
<script type="text/javascript">
[13] Fix | Delete
var DOCUMENTATION_OPTIONS = {
[14] Fix | Delete
URL_ROOT: '../',
[15] Fix | Delete
VERSION: '2.7.12',
[16] Fix | Delete
COLLAPSE_INDEX: false,
[17] Fix | Delete
FILE_SUFFIX: '.html',
[18] Fix | Delete
HAS_SOURCE: true
[19] Fix | Delete
};
[20] Fix | Delete
</script>
[21] Fix | Delete
<script type="text/javascript" src="../_static/jquery.js"></script>
[22] Fix | Delete
<script type="text/javascript" src="../_static/underscore.js"></script>
[23] Fix | Delete
<script type="text/javascript" src="../_static/doctools.js"></script>
[24] Fix | Delete
<script type="text/javascript" src="../_static/sidebar.js"></script>
[25] Fix | Delete
<link rel="search" type="application/opensearchdescription+xml"
[26] Fix | Delete
title="Search within Python 2.7.12 documentation"
[27] Fix | Delete
href="../_static/opensearch.xml"/>
[28] Fix | Delete
<link rel="author" title="About these documents" href="../about.html" />
[29] Fix | Delete
<link rel="copyright" title="Copyright" href="../copyright.html" />
[30] Fix | Delete
<link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
[31] Fix | Delete
<link rel="up" title="24. Graphical User Interfaces with Tk" href="tk.html" />
[32] Fix | Delete
<link rel="next" title="24.7. Other Graphical User Interface Packages" href="othergui.html" />
[33] Fix | Delete
<link rel="prev" title="24.5. turtle — Turtle graphics for Tk" href="turtle.html" />
[34] Fix | Delete
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
[35] Fix | Delete
<script type="text/javascript" src="../_static/copybutton.js"></script>
[36] Fix | Delete
[37] Fix | Delete
[38] Fix | Delete
[39] Fix | Delete
[40] Fix | Delete
</head>
[41] Fix | Delete
<body role="document">
[42] Fix | Delete
<div class="related" role="navigation" aria-label="related navigation">
[43] Fix | Delete
<h3>Navigation</h3>
[44] Fix | Delete
<ul>
[45] Fix | Delete
<li class="right" style="margin-right: 10px">
[46] Fix | Delete
<a href="../genindex.html" title="General Index"
[47] Fix | Delete
accesskey="I">index</a></li>
[48] Fix | Delete
<li class="right" >
[49] Fix | Delete
<a href="../py-modindex.html" title="Python Module Index"
[50] Fix | Delete
>modules</a> |</li>
[51] Fix | Delete
<li class="right" >
[52] Fix | Delete
<a href="othergui.html" title="24.7. Other Graphical User Interface Packages"
[53] Fix | Delete
accesskey="N">next</a> |</li>
[54] Fix | Delete
<li class="right" >
[55] Fix | Delete
<a href="turtle.html" title="24.5. turtle — Turtle graphics for Tk"
[56] Fix | Delete
accesskey="P">previous</a> |</li>
[57] Fix | Delete
<li><img src="../_static/py.png" alt=""
[58] Fix | Delete
style="vertical-align: middle; margin-top: -1px"/></li>
[59] Fix | Delete
<li><a href="https://www.python.org/">Python</a> &raquo;</li>
[60] Fix | Delete
<li>
[61] Fix | Delete
<a href="../index.html">Python 2.7.12 documentation</a> &raquo;
[62] Fix | Delete
</li>
[63] Fix | Delete
[64] Fix | Delete
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &raquo;</li>
[65] Fix | Delete
<li class="nav-item nav-item-2"><a href="tk.html" accesskey="U">24. Graphical User Interfaces with Tk</a> &raquo;</li>
[66] Fix | Delete
</ul>
[67] Fix | Delete
</div>
[68] Fix | Delete
[69] Fix | Delete
<div class="document">
[70] Fix | Delete
<div class="documentwrapper">
[71] Fix | Delete
<div class="bodywrapper">
[72] Fix | Delete
<div class="body" role="main">
[73] Fix | Delete
[74] Fix | Delete
<div class="section" id="idle">
[75] Fix | Delete
<span id="id1"></span><h1>24.6. IDLE<a class="headerlink" href="#idle" title="Permalink to this headline">¶</a></h1>
[76] Fix | Delete
<p id="index-0">IDLE is Python&#8217;s Integrated Development and Learning Environment.</p>
[77] Fix | Delete
<p>IDLE has the following features:</p>
[78] Fix | Delete
<ul class="simple">
[79] Fix | Delete
<li>coded in 100% pure Python, using the <code class="xref py py-mod docutils literal"><span class="pre">tkinter</span></code> GUI toolkit</li>
[80] Fix | Delete
<li>cross-platform: works mostly the same on Windows, Unix, and Mac OS X</li>
[81] Fix | Delete
<li>Python shell window (interactive interpreter) with colorizing
[82] Fix | Delete
of code input, output, and error messages</li>
[83] Fix | Delete
<li>multi-window text editor with multiple undo, Python colorizing,
[84] Fix | Delete
smart indent, call tips, auto completion, and other features</li>
[85] Fix | Delete
<li>search within any window, replace within editor windows, and search
[86] Fix | Delete
through multiple files (grep)</li>
[87] Fix | Delete
<li>debugger with persistent breakpoints, stepping, and viewing
[88] Fix | Delete
of global and local namespaces</li>
[89] Fix | Delete
<li>configuration, browsers, and other dialogs</li>
[90] Fix | Delete
</ul>
[91] Fix | Delete
<div class="section" id="menus">
[92] Fix | Delete
<h2>24.6.1. Menus<a class="headerlink" href="#menus" title="Permalink to this headline">¶</a></h2>
[93] Fix | Delete
<p>IDLE has two main window types, the Shell window and the Editor window. It is
[94] Fix | Delete
possible to have multiple editor windows simultaneously. Output windows, such
[95] Fix | Delete
as used for Edit / Find in Files, are a subtype of edit window. They currently
[96] Fix | Delete
have the same top menu as Editor windows but a different default title and
[97] Fix | Delete
context menu.</p>
[98] Fix | Delete
<p>IDLE&#8217;s menus dynamically change based on which window is currently selected.
[99] Fix | Delete
Each menu documented below indicates which window type it is associated with.</p>
[100] Fix | Delete
<div class="section" id="file-menu-shell-and-editor">
[101] Fix | Delete
<h3>24.6.1.1. File menu (Shell and Editor)<a class="headerlink" href="#file-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
[102] Fix | Delete
<dl class="docutils">
[103] Fix | Delete
<dt>New File</dt>
[104] Fix | Delete
<dd>Create a new file editing window.</dd>
[105] Fix | Delete
<dt>Open...</dt>
[106] Fix | Delete
<dd>Open an existing file with an Open dialog.</dd>
[107] Fix | Delete
<dt>Recent Files</dt>
[108] Fix | Delete
<dd>Open a list of recent files. Click one to open it.</dd>
[109] Fix | Delete
<dt>Open Module...</dt>
[110] Fix | Delete
<dd>Open an existing module (searches sys.path).</dd>
[111] Fix | Delete
</dl>
[112] Fix | Delete
<dl class="docutils" id="index-1">
[113] Fix | Delete
<dt>Class Browser</dt>
[114] Fix | Delete
<dd>Show functions, classes, and methods in the current Editor file in a
[115] Fix | Delete
tree structure. In the shell, open a module first.</dd>
[116] Fix | Delete
<dt>Path Browser</dt>
[117] Fix | Delete
<dd>Show sys.path directories, modules, functions, classes and methods in a
[118] Fix | Delete
tree structure.</dd>
[119] Fix | Delete
<dt>Save</dt>
[120] Fix | Delete
<dd>Save the current window to the associated file, if there is one. Windows
[121] Fix | Delete
that have been changed since being opened or last saved have a * before
[122] Fix | Delete
and after the window title. If there is no associated file,
[123] Fix | Delete
do Save As instead.</dd>
[124] Fix | Delete
<dt>Save As...</dt>
[125] Fix | Delete
<dd>Save the current window with a Save As dialog. The file saved becomes the
[126] Fix | Delete
new associated file for the window.</dd>
[127] Fix | Delete
<dt>Save Copy As...</dt>
[128] Fix | Delete
<dd>Save the current window to different file without changing the associated
[129] Fix | Delete
file.</dd>
[130] Fix | Delete
<dt>Print Window</dt>
[131] Fix | Delete
<dd>Print the current window to the default printer.</dd>
[132] Fix | Delete
<dt>Close</dt>
[133] Fix | Delete
<dd>Close the current window (ask to save if unsaved).</dd>
[134] Fix | Delete
<dt>Exit</dt>
[135] Fix | Delete
<dd>Close all windows and quit IDLE (ask to save unsaved windows).</dd>
[136] Fix | Delete
</dl>
[137] Fix | Delete
</div>
[138] Fix | Delete
<div class="section" id="edit-menu-shell-and-editor">
[139] Fix | Delete
<h3>24.6.1.2. Edit menu (Shell and Editor)<a class="headerlink" href="#edit-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
[140] Fix | Delete
<dl class="docutils">
[141] Fix | Delete
<dt>Undo</dt>
[142] Fix | Delete
<dd>Undo the last change to the current window. A maximum of 1000 changes may
[143] Fix | Delete
be undone.</dd>
[144] Fix | Delete
<dt>Redo</dt>
[145] Fix | Delete
<dd>Redo the last undone change to the current window.</dd>
[146] Fix | Delete
<dt>Cut</dt>
[147] Fix | Delete
<dd>Copy selection into the system-wide clipboard; then delete the selection.</dd>
[148] Fix | Delete
<dt>Copy</dt>
[149] Fix | Delete
<dd>Copy selection into the system-wide clipboard.</dd>
[150] Fix | Delete
<dt>Paste</dt>
[151] Fix | Delete
<dd>Insert contents of the system-wide clipboard into the current window.</dd>
[152] Fix | Delete
</dl>
[153] Fix | Delete
<p>The clipboard functions are also available in context menus.</p>
[154] Fix | Delete
<dl class="docutils">
[155] Fix | Delete
<dt>Select All</dt>
[156] Fix | Delete
<dd>Select the entire contents of the current window.</dd>
[157] Fix | Delete
<dt>Find...</dt>
[158] Fix | Delete
<dd>Open a search dialog with many options</dd>
[159] Fix | Delete
<dt>Find Again</dt>
[160] Fix | Delete
<dd>Repeat the last search, if there is one.</dd>
[161] Fix | Delete
<dt>Find Selection</dt>
[162] Fix | Delete
<dd>Search for the currently selected string, if there is one.</dd>
[163] Fix | Delete
<dt>Find in Files...</dt>
[164] Fix | Delete
<dd>Open a file search dialog. Put results in a new output window.</dd>
[165] Fix | Delete
<dt>Replace...</dt>
[166] Fix | Delete
<dd>Open a search-and-replace dialog.</dd>
[167] Fix | Delete
<dt>Go to Line</dt>
[168] Fix | Delete
<dd>Move cursor to the line number requested and make that line visible.</dd>
[169] Fix | Delete
<dt>Show Completions</dt>
[170] Fix | Delete
<dd>Open a scrollable list allowing selection of keywords and attributes. See
[171] Fix | Delete
Completions in the Tips sections below.</dd>
[172] Fix | Delete
<dt>Expand Word</dt>
[173] Fix | Delete
<dd>Expand a prefix you have typed to match a full word in the same window;
[174] Fix | Delete
repeat to get a different expansion.</dd>
[175] Fix | Delete
<dt>Show call tip</dt>
[176] Fix | Delete
<dd>After an unclosed parenthesis for a function, open a small window with
[177] Fix | Delete
function parameter hints.</dd>
[178] Fix | Delete
<dt>Show surrounding parens</dt>
[179] Fix | Delete
<dd>Highlight the surrounding parenthesis.</dd>
[180] Fix | Delete
</dl>
[181] Fix | Delete
</div>
[182] Fix | Delete
<div class="section" id="format-menu-editor-window-only">
[183] Fix | Delete
<h3>24.6.1.3. Format menu (Editor window only)<a class="headerlink" href="#format-menu-editor-window-only" title="Permalink to this headline">¶</a></h3>
[184] Fix | Delete
<dl class="docutils">
[185] Fix | Delete
<dt>Indent Region</dt>
[186] Fix | Delete
<dd>Shift selected lines right by the indent width (default 4 spaces).</dd>
[187] Fix | Delete
<dt>Dedent Region</dt>
[188] Fix | Delete
<dd>Shift selected lines left by the indent width (default 4 spaces).</dd>
[189] Fix | Delete
<dt>Comment Out Region</dt>
[190] Fix | Delete
<dd>Insert ## in front of selected lines.</dd>
[191] Fix | Delete
<dt>Uncomment Region</dt>
[192] Fix | Delete
<dd>Remove leading # or ## from selected lines.</dd>
[193] Fix | Delete
<dt>Tabify Region</dt>
[194] Fix | Delete
<dd>Turn <em>leading</em> stretches of spaces into tabs. (Note: We recommend using
[195] Fix | Delete
4 space blocks to indent Python code.)</dd>
[196] Fix | Delete
<dt>Untabify Region</dt>
[197] Fix | Delete
<dd>Turn <em>all</em> tabs into the correct number of spaces.</dd>
[198] Fix | Delete
<dt>Toggle Tabs</dt>
[199] Fix | Delete
<dd>Open a dialog to switch between indenting with spaces and tabs.</dd>
[200] Fix | Delete
<dt>New Indent Width</dt>
[201] Fix | Delete
<dd>Open a dialog to change indent width. The accepted default by the Python
[202] Fix | Delete
community is 4 spaces.</dd>
[203] Fix | Delete
<dt>Format Paragraph</dt>
[204] Fix | Delete
<dd>Reformat the current blank-line-delimited paragraph in comment block or
[205] Fix | Delete
multiline string or selected line in a string. All lines in the
[206] Fix | Delete
paragraph will be formatted to less than N columns, where N defaults to 72.</dd>
[207] Fix | Delete
<dt>Strip trailing whitespace</dt>
[208] Fix | Delete
<dd>Remove any space characters after the last non-space character of a line.</dd>
[209] Fix | Delete
</dl>
[210] Fix | Delete
</div>
[211] Fix | Delete
<div class="section" id="run-menu-editor-window-only">
[212] Fix | Delete
<span id="index-2"></span><h3>24.6.1.4. Run menu (Editor window only)<a class="headerlink" href="#run-menu-editor-window-only" title="Permalink to this headline">¶</a></h3>
[213] Fix | Delete
<dl class="docutils">
[214] Fix | Delete
<dt>Python Shell</dt>
[215] Fix | Delete
<dd>Open or wake up the Python Shell window.</dd>
[216] Fix | Delete
<dt>Check Module</dt>
[217] Fix | Delete
<dd>Check the syntax of the module currently open in the Editor window. If the
[218] Fix | Delete
module has not been saved IDLE will either prompt the user to save or
[219] Fix | Delete
autosave, as selected in the General tab of the Idle Settings dialog. If
[220] Fix | Delete
there is a syntax error, the approximate location is indicated in the
[221] Fix | Delete
Editor window.</dd>
[222] Fix | Delete
<dt>Run Module</dt>
[223] Fix | Delete
<dd>Do Check Module (above). If no error, restart the shell to clean the
[224] Fix | Delete
environment, then execute the module. Output is displayed in the Shell
[225] Fix | Delete
window. Note that output requires use of <code class="docutils literal"><span class="pre">print</span></code> or <code class="docutils literal"><span class="pre">write</span></code>.
[226] Fix | Delete
When execution is complete, the Shell retains focus and displays a prompt.
[227] Fix | Delete
At this point, one may interactively explore the result of execution.
[228] Fix | Delete
This is similar to executing a file with <code class="docutils literal"><span class="pre">python</span> <span class="pre">-i</span> <span class="pre">file</span></code> at a command
[229] Fix | Delete
line.</dd>
[230] Fix | Delete
</dl>
[231] Fix | Delete
</div>
[232] Fix | Delete
<div class="section" id="shell-menu-shell-window-only">
[233] Fix | Delete
<h3>24.6.1.5. Shell menu (Shell window only)<a class="headerlink" href="#shell-menu-shell-window-only" title="Permalink to this headline">¶</a></h3>
[234] Fix | Delete
<dl class="docutils">
[235] Fix | Delete
<dt>View Last Restart</dt>
[236] Fix | Delete
<dd>Scroll the shell window to the last Shell restart.</dd>
[237] Fix | Delete
<dt>Restart Shell</dt>
[238] Fix | Delete
<dd>Restart the shell to clean the environment.</dd>
[239] Fix | Delete
<dt>Interrupt Execution</dt>
[240] Fix | Delete
<dd>Stop a running program.</dd>
[241] Fix | Delete
</dl>
[242] Fix | Delete
</div>
[243] Fix | Delete
<div class="section" id="debug-menu-shell-window-only">
[244] Fix | Delete
<h3>24.6.1.6. Debug menu (Shell window only)<a class="headerlink" href="#debug-menu-shell-window-only" title="Permalink to this headline">¶</a></h3>
[245] Fix | Delete
<dl class="docutils">
[246] Fix | Delete
<dt>Go to File/Line</dt>
[247] Fix | Delete
<dd>Look on the current line. with the cursor, and the line above for a filename
[248] Fix | Delete
and line number. If found, open the file if not already open, and show the
[249] Fix | Delete
line. Use this to view source lines referenced in an exception traceback
[250] Fix | Delete
and lines found by Find in Files. Also available in the context menu of
[251] Fix | Delete
the Shell window and Output windows.</dd>
[252] Fix | Delete
</dl>
[253] Fix | Delete
<dl class="docutils" id="index-3">
[254] Fix | Delete
<dt>Debugger (toggle)</dt>
[255] Fix | Delete
<dd>When actived, code entered in the Shell or run from an Editor will run
[256] Fix | Delete
under the debugger. In the Editor, breakpoints can be set with the context
[257] Fix | Delete
menu. This feature is still incomplete and somewhat experimental.</dd>
[258] Fix | Delete
<dt>Stack Viewer</dt>
[259] Fix | Delete
<dd>Show the stack traceback of the last exception in a tree widget, with
[260] Fix | Delete
access to locals and globals.</dd>
[261] Fix | Delete
<dt>Auto-open Stack Viewer</dt>
[262] Fix | Delete
<dd>Toggle automatically opening the stack viewer on an unhandled exception.</dd>
[263] Fix | Delete
</dl>
[264] Fix | Delete
</div>
[265] Fix | Delete
<div class="section" id="options-menu-shell-and-editor">
[266] Fix | Delete
<h3>24.6.1.7. Options menu (Shell and Editor)<a class="headerlink" href="#options-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
[267] Fix | Delete
<dl class="docutils">
[268] Fix | Delete
<dt>Configure IDLE</dt>
[269] Fix | Delete
<dd><p class="first">Open a configuration dialog and change preferences for the following:
[270] Fix | Delete
fonts, indentation, keybindings, text color themes, startup windows and
[271] Fix | Delete
size, additional help sources, and extensions (see below). On OS X,
[272] Fix | Delete
open the configuration dialog by selecting Preferences in the application
[273] Fix | Delete
menu. To use a new built-in color theme (IDLE Dark) with older IDLEs,
[274] Fix | Delete
save it as a new custom theme.</p>
[275] Fix | Delete
<p class="last">Non-default user settings are saved in a .idlerc directory in the user&#8217;s
[276] Fix | Delete
home directory. Problems caused by bad user configuration files are solved
[277] Fix | Delete
by editing or deleting one or more of the files in .idlerc.</p>
[278] Fix | Delete
</dd>
[279] Fix | Delete
<dt>Code Context (toggle)(Editor Window only)</dt>
[280] Fix | Delete
<dd>Open a pane at the top of the edit window which shows the block context
[281] Fix | Delete
of the code which has scrolled above the top of the window.</dd>
[282] Fix | Delete
</dl>
[283] Fix | Delete
</div>
[284] Fix | Delete
<div class="section" id="window-menu-shell-and-editor">
[285] Fix | Delete
<h3>24.6.1.8. Window menu (Shell and Editor)<a class="headerlink" href="#window-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
[286] Fix | Delete
<dl class="docutils">
[287] Fix | Delete
<dt>Zoom Height</dt>
[288] Fix | Delete
<dd>Toggles the window between normal size and maximum height. The initial size
[289] Fix | Delete
defaults to 40 lines by 80 chars unless changed on the General tab of the
[290] Fix | Delete
Configure IDLE dialog.</dd>
[291] Fix | Delete
</dl>
[292] Fix | Delete
<p>The rest of this menu lists the names of all open windows; select one to bring
[293] Fix | Delete
it to the foreground (deiconifying it if necessary).</p>
[294] Fix | Delete
</div>
[295] Fix | Delete
<div class="section" id="help-menu-shell-and-editor">
[296] Fix | Delete
<h3>24.6.1.9. Help menu (Shell and Editor)<a class="headerlink" href="#help-menu-shell-and-editor" title="Permalink to this headline">¶</a></h3>
[297] Fix | Delete
<dl class="docutils">
[298] Fix | Delete
<dt>About IDLE</dt>
[299] Fix | Delete
<dd>Display version, copyright, license, credits, and more.</dd>
[300] Fix | Delete
<dt>IDLE Help</dt>
[301] Fix | Delete
<dd>Display a help file for IDLE detailing the menu options, basic editing and
[302] Fix | Delete
navigation, and other tips.</dd>
[303] Fix | Delete
<dt>Python Docs</dt>
[304] Fix | Delete
<dd>Access local Python documentation, if installed, or start a web browser
[305] Fix | Delete
and open docs.python.org showing the latest Python documentation.</dd>
[306] Fix | Delete
<dt>Turtle Demo</dt>
[307] Fix | Delete
<dd>Run the turtledemo module with example python code and turtle drawings.</dd>
[308] Fix | Delete
</dl>
[309] Fix | Delete
<p>Additional help sources may be added here with the Configure IDLE dialog under
[310] Fix | Delete
the General tab.</p>
[311] Fix | Delete
</div>
[312] Fix | Delete
<div class="section" id="context-menus">
[313] Fix | Delete
<span id="index-4"></span><h3>24.6.1.10. Context Menus<a class="headerlink" href="#context-menus" title="Permalink to this headline">¶</a></h3>
[314] Fix | Delete
<p>Open a context menu by right-clicking in a window (Control-click on OS X).
[315] Fix | Delete
Context menus have the standard clipboard functions also on the Edit menu.</p>
[316] Fix | Delete
<dl class="docutils">
[317] Fix | Delete
<dt>Cut</dt>
[318] Fix | Delete
<dd>Copy selection into the system-wide clipboard; then delete the selection.</dd>
[319] Fix | Delete
<dt>Copy</dt>
[320] Fix | Delete
<dd>Copy selection into the system-wide clipboard.</dd>
[321] Fix | Delete
<dt>Paste</dt>
[322] Fix | Delete
<dd>Insert contents of the system-wide clipboard into the current window.</dd>
[323] Fix | Delete
</dl>
[324] Fix | Delete
<p>Editor windows also have breakpoint functions. Lines with a breakpoint set are
[325] Fix | Delete
specially marked. Breakpoints only have an effect when running under the
[326] Fix | Delete
debugger. Breakpoints for a file are saved in the user&#8217;s .idlerc directory.</p>
[327] Fix | Delete
<dl class="docutils">
[328] Fix | Delete
<dt>Set Breakpoint</dt>
[329] Fix | Delete
<dd>Set a breakpoint on the current line.</dd>
[330] Fix | Delete
<dt>Clear Breakpoint</dt>
[331] Fix | Delete
<dd>Clear the breakpoint on that line.</dd>
[332] Fix | Delete
</dl>
[333] Fix | Delete
<p>Shell and Output windows have the following.</p>
[334] Fix | Delete
<dl class="docutils">
[335] Fix | Delete
<dt>Go to file/line</dt>
[336] Fix | Delete
<dd>Same as in Debug menu.</dd>
[337] Fix | Delete
</dl>
[338] Fix | Delete
</div>
[339] Fix | Delete
</div>
[340] Fix | Delete
<div class="section" id="editing-and-navigation">
[341] Fix | Delete
<h2>24.6.2. Editing and navigation<a class="headerlink" href="#editing-and-navigation" title="Permalink to this headline">¶</a></h2>
[342] Fix | Delete
<p>In this section, &#8216;C&#8217; refers to the <code class="kbd docutils literal"><span class="pre">Control</span></code> key on Windows and Unix and
[343] Fix | Delete
the <code class="kbd docutils literal"><span class="pre">Command</span></code> key on Mac OSX.</p>
[344] Fix | Delete
<ul>
[345] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">Backspace</span></code> deletes to the left; <code class="kbd docutils literal"><span class="pre">Del</span></code> deletes to the right</p>
[346] Fix | Delete
</li>
[347] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">C-Backspace</span></code> delete word left; <code class="kbd docutils literal"><span class="pre">C-Del</span></code> delete word to the right</p>
[348] Fix | Delete
</li>
[349] Fix | Delete
<li><p class="first">Arrow keys and <code class="kbd docutils literal"><span class="pre">Page</span> <span class="pre">Up</span></code>/<code class="kbd docutils literal"><span class="pre">Page</span> <span class="pre">Down</span></code> to move around</p>
[350] Fix | Delete
</li>
[351] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">C-LeftArrow</span></code> and <code class="kbd docutils literal"><span class="pre">C-RightArrow</span></code> moves by words</p>
[352] Fix | Delete
</li>
[353] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">Home</span></code>/<code class="kbd docutils literal"><span class="pre">End</span></code> go to begin/end of line</p>
[354] Fix | Delete
</li>
[355] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">C-Home</span></code>/<code class="kbd docutils literal"><span class="pre">C-End</span></code> go to begin/end of file</p>
[356] Fix | Delete
</li>
[357] Fix | Delete
<li><p class="first">Some useful Emacs bindings are inherited from Tcl/Tk:</p>
[358] Fix | Delete
<blockquote>
[359] Fix | Delete
<div><ul class="simple">
[360] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-a</span></code> beginning of line</li>
[361] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-e</span></code> end of line</li>
[362] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-k</span></code> kill line (but doesn&#8217;t put it in clipboard)</li>
[363] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-l</span></code> center window around the insertion point</li>
[364] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-b</span></code> go backwards one character without deleting (usually you can
[365] Fix | Delete
also use the cursor key for this)</li>
[366] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-f</span></code> go forward one character without deleting (usually you can
[367] Fix | Delete
also use the cursor key for this)</li>
[368] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-p</span></code> go up one line (usually you can also use the cursor key for
[369] Fix | Delete
this)</li>
[370] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">C-d</span></code> delete next character</li>
[371] Fix | Delete
</ul>
[372] Fix | Delete
</div></blockquote>
[373] Fix | Delete
</li>
[374] Fix | Delete
</ul>
[375] Fix | Delete
<p>Standard keybindings (like <code class="kbd docutils literal"><span class="pre">C-c</span></code> to copy and <code class="kbd docutils literal"><span class="pre">C-v</span></code> to paste)
[376] Fix | Delete
may work. Keybindings are selected in the Configure IDLE dialog.</p>
[377] Fix | Delete
<div class="section" id="automatic-indentation">
[378] Fix | Delete
<h3>24.6.2.1. Automatic indentation<a class="headerlink" href="#automatic-indentation" title="Permalink to this headline">¶</a></h3>
[379] Fix | Delete
<p>After a block-opening statement, the next line is indented by 4 spaces (in the
[380] Fix | Delete
Python Shell window by one tab). After certain keywords (break, return etc.)
[381] Fix | Delete
the next line is dedented. In leading indentation, <code class="kbd docutils literal"><span class="pre">Backspace</span></code> deletes up
[382] Fix | Delete
to 4 spaces if they are there. <code class="kbd docutils literal"><span class="pre">Tab</span></code> inserts spaces (in the Python
[383] Fix | Delete
Shell window one tab), number depends on Indent width. Currently tabs
[384] Fix | Delete
are restricted to four spaces due to Tcl/Tk limitations.</p>
[385] Fix | Delete
<p>See also the indent/dedent region commands in the edit menu.</p>
[386] Fix | Delete
</div>
[387] Fix | Delete
<div class="section" id="completions">
[388] Fix | Delete
<h3>24.6.2.2. Completions<a class="headerlink" href="#completions" title="Permalink to this headline">¶</a></h3>
[389] Fix | Delete
<p>Completions are supplied for functions, classes, and attributes of classes,
[390] Fix | Delete
both built-in and user-defined. Completions are also provided for
[391] Fix | Delete
filenames.</p>
[392] Fix | Delete
<p>The AutoCompleteWindow (ACW) will open after a predefined delay (default is
[393] Fix | Delete
two seconds) after a &#8216;.&#8217; or (in a string) an os.sep is typed. If after one
[394] Fix | Delete
of those characters (plus zero or more other characters) a tab is typed
[395] Fix | Delete
the ACW will open immediately if a possible continuation is found.</p>
[396] Fix | Delete
<p>If there is only one possible completion for the characters entered, a
[397] Fix | Delete
<code class="kbd docutils literal"><span class="pre">Tab</span></code> will supply that completion without opening the ACW.</p>
[398] Fix | Delete
<p>&#8216;Show Completions&#8217; will force open a completions window, by default the
[399] Fix | Delete
<code class="kbd docutils literal"><span class="pre">C-space</span></code> will open a completions window. In an empty
[400] Fix | Delete
string, this will contain the files in the current directory. On a
[401] Fix | Delete
blank line, it will contain the built-in and user-defined functions and
[402] Fix | Delete
classes in the current name spaces, plus any modules imported. If some
[403] Fix | Delete
characters have been entered, the ACW will attempt to be more specific.</p>
[404] Fix | Delete
<p>If a string of characters is typed, the ACW selection will jump to the
[405] Fix | Delete
entry most closely matching those characters. Entering a <code class="kbd docutils literal"><span class="pre">tab</span></code> will
[406] Fix | Delete
cause the longest non-ambiguous match to be entered in the Editor window or
[407] Fix | Delete
Shell. Two <code class="kbd docutils literal"><span class="pre">tab</span></code> in a row will supply the current ACW selection, as
[408] Fix | Delete
will return or a double click. Cursor keys, Page Up/Down, mouse selection,
[409] Fix | Delete
and the scroll wheel all operate on the ACW.</p>
[410] Fix | Delete
<p>&#8220;Hidden&#8221; attributes can be accessed by typing the beginning of hidden
[411] Fix | Delete
name after a &#8216;.&#8217;, e.g. &#8216;_&#8217;. This allows access to modules with
[412] Fix | Delete
<code class="docutils literal"><span class="pre">__all__</span></code> set, or to class-private attributes.</p>
[413] Fix | Delete
<p>Completions and the &#8216;Expand Word&#8217; facility can save a lot of typing!</p>
[414] Fix | Delete
<p>Completions are currently limited to those in the namespaces. Names in
[415] Fix | Delete
an Editor window which are not via <code class="docutils literal"><span class="pre">__main__</span></code> and <a class="reference internal" href="sys.html#sys.modules" title="sys.modules"><code class="xref py py-data docutils literal"><span class="pre">sys.modules</span></code></a> will
[416] Fix | Delete
not be found. Run the module once with your imports to correct this situation.
[417] Fix | Delete
Note that IDLE itself places quite a few modules in sys.modules, so
[418] Fix | Delete
much can be found by default, e.g. the re module.</p>
[419] Fix | Delete
<p>If you don&#8217;t like the ACW popping up unbidden, simply make the delay
[420] Fix | Delete
longer or disable the extension.</p>
[421] Fix | Delete
</div>
[422] Fix | Delete
<div class="section" id="calltips">
[423] Fix | Delete
<h3>24.6.2.3. Calltips<a class="headerlink" href="#calltips" title="Permalink to this headline">¶</a></h3>
[424] Fix | Delete
<p>A calltip is shown when one types <code class="kbd docutils literal"><span class="pre">(</span></code> after the name of an <em>acccessible</em>
[425] Fix | Delete
function. A name expression may include dots and subscripts. A calltip
[426] Fix | Delete
remains until it is clicked, the cursor is moved out of the argument area,
[427] Fix | Delete
or <code class="kbd docutils literal"><span class="pre">)</span></code> is typed. When the cursor is in the argument part of a definition,
[428] Fix | Delete
the menu or shortcut display a calltip.</p>
[429] Fix | Delete
<p>A calltip consists of the function signature and the first line of the
[430] Fix | Delete
docstring. For builtins without an accessible signature, the calltip
[431] Fix | Delete
consists of all lines up the fifth line or the first blank line. These
[432] Fix | Delete
details may change.</p>
[433] Fix | Delete
<p>The set of <em>accessible</em> functions depends on what modules have been imported
[434] Fix | Delete
into the user process, including those imported by Idle itself,
[435] Fix | Delete
and what definitions have been run, all since the last restart.</p>
[436] Fix | Delete
<p>For example, restart the Shell and enter <code class="docutils literal"><span class="pre">itertools.count(</span></code>. A calltip
[437] Fix | Delete
appears because Idle imports itertools into the user process for its own use.
[438] Fix | Delete
(This could change.) Enter <code class="docutils literal"><span class="pre">turtle.write(</span></code> and nothing appears. Idle does
[439] Fix | Delete
not import turtle. The menu or shortcut do nothing either. Enter
[440] Fix | Delete
<code class="docutils literal"><span class="pre">import</span> <span class="pre">turtle</span></code> and then <code class="docutils literal"><span class="pre">turtle.write(</span></code> will work.</p>
[441] Fix | Delete
<p>In an editor, import statements have no effect until one runs the file. One
[442] Fix | Delete
might want to run a file after writing the import statements at the top,
[443] Fix | Delete
or immediately run an existing file before editing.</p>
[444] Fix | Delete
</div>
[445] Fix | Delete
<div class="section" id="python-shell-window">
[446] Fix | Delete
<h3>24.6.2.4. Python Shell window<a class="headerlink" href="#python-shell-window" title="Permalink to this headline">¶</a></h3>
[447] Fix | Delete
<ul>
[448] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">C-c</span></code> interrupts executing command</p>
[449] Fix | Delete
</li>
[450] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">C-d</span></code> sends end-of-file; closes window if typed at a <code class="docutils literal"><span class="pre">&gt;&gt;&gt;</span></code> prompt</p>
[451] Fix | Delete
</li>
[452] Fix | Delete
<li><p class="first"><code class="kbd docutils literal"><span class="pre">Alt-/</span></code> (Expand word) is also useful to reduce typing</p>
[453] Fix | Delete
<p>Command history</p>
[454] Fix | Delete
<ul class="simple">
[455] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">Alt-p</span></code> retrieves previous command matching what you have typed. On
[456] Fix | Delete
OS X use <code class="kbd docutils literal"><span class="pre">C-p</span></code>.</li>
[457] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">Alt-n</span></code> retrieves next. On OS X use <code class="kbd docutils literal"><span class="pre">C-n</span></code>.</li>
[458] Fix | Delete
<li><code class="kbd docutils literal"><span class="pre">Return</span></code> while on any previous command retrieves that command</li>
[459] Fix | Delete
</ul>
[460] Fix | Delete
</li>
[461] Fix | Delete
</ul>
[462] Fix | Delete
</div>
[463] Fix | Delete
<div class="section" id="text-colors">
[464] Fix | Delete
<h3>24.6.2.5. Text colors<a class="headerlink" href="#text-colors" title="Permalink to this headline">¶</a></h3>
[465] Fix | Delete
<p>Idle defaults to black on white text, but colors text with special meanings.
[466] Fix | Delete
For the shell, these are shell output, shell error, user output, and
[467] Fix | Delete
user error. For Python code, at the shell prompt or in an editor, these are
[468] Fix | Delete
keywords, builtin class and function names, names following <code class="docutils literal"><span class="pre">class</span></code> and
[469] Fix | Delete
<code class="docutils literal"><span class="pre">def</span></code>, strings, and comments. For any text window, these are the cursor (when
[470] Fix | Delete
present), found text (when possible), and selected text.</p>
[471] Fix | Delete
<p>Text coloring is done in the background, so uncolorized text is occasionally
[472] Fix | Delete
visible. To change the color scheme, use the Configure IDLE dialog
[473] Fix | Delete
Highlighting tab. The marking of debugger breakpoint lines in the editor and
[474] Fix | Delete
text in popups and dialogs is not user-configurable.</p>
[475] Fix | Delete
</div>
[476] Fix | Delete
</div>
[477] Fix | Delete
<div class="section" id="startup-and-code-execution">
[478] Fix | Delete
<h2>24.6.3. Startup and code execution<a class="headerlink" href="#startup-and-code-execution" title="Permalink to this headline">¶</a></h2>
[479] Fix | Delete
<p>Upon startup with the <code class="docutils literal"><span class="pre">-s</span></code> option, IDLE will execute the file referenced by
[480] Fix | Delete
the environment variables <span class="target" id="index-5"></span><code class="xref std std-envvar docutils literal"><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"><span class="pre">PYTHONSTARTUP</span></code></a>.
[481] Fix | Delete
IDLE first checks for <code class="docutils literal"><span class="pre">IDLESTARTUP</span></code>; if <code class="docutils literal"><span class="pre">IDLESTARTUP</span></code> is present the file
[482] Fix | Delete
referenced is run. If <code class="docutils literal"><span class="pre">IDLESTARTUP</span></code> is not present, IDLE checks for
[483] Fix | Delete
<code class="docutils literal"><span class="pre">PYTHONSTARTUP</span></code>. Files referenced by these environment variables are
[484] Fix | Delete
convenient places to store functions that are used frequently from the IDLE
[485] Fix | Delete
shell, or for executing import statements to import common modules.</p>
[486] Fix | Delete
<p>In addition, <code class="docutils literal"><span class="pre">Tk</span></code> also loads a startup file if it is present. Note that the
[487] Fix | Delete
Tk file is loaded unconditionally. This additional file is <code class="docutils literal"><span class="pre">.Idle.py</span></code> and is
[488] Fix | Delete
looked for in the user&#8217;s home directory. Statements in this file will be
[489] Fix | Delete
executed in the Tk namespace, so this file is not useful for importing
[490] Fix | Delete
functions to be used from IDLE&#8217;s Python shell.</p>
[491] Fix | Delete
<div class="section" id="command-line-usage">
[492] Fix | Delete
<h3>24.6.3.1. Command line usage<a class="headerlink" href="#command-line-usage" title="Permalink to this headline">¶</a></h3>
[493] Fix | Delete
<div class="highlight-none"><div class="highlight"><pre><span></span>idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ...
[494] Fix | Delete
[495] Fix | Delete
-c command run command in the shell window
[496] Fix | Delete
-d enable debugger and open shell window
[497] Fix | Delete
-e open editor window
[498] Fix | Delete
-h print help message with legal combinations and exit
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function