blob: e64f6831d92ae5ffaf967e1376c166db52dc03c1 [file] [log] [blame]
Georg Brandl116aa622007-08-15 14:28:22 +00001.. _idle:
2
Ned Deily50afcc02015-02-06 15:42:06 +11003IDLE
4====
5
Georg Brandl116aa622007-08-15 14:28:22 +00006.. index::
Christian Heimes5b5e81c2007-12-31 16:14:33 +00007 single: IDLE
Georg Brandl116aa622007-08-15 14:28:22 +00008 single: Python Editor
9 single: Integrated Development Environment
10
Terry Jan Reedyf5684942014-12-04 00:54:59 -050011.. moduleauthor:: Guido van Rossum <guido@Python.org>
12
Georg Brandlac6060c2008-05-17 18:44:45 +000013IDLE is the Python IDE built with the :mod:`tkinter` GUI toolkit.
Georg Brandl116aa622007-08-15 14:28:22 +000014
15IDLE has the following features:
16
Georg Brandlac6060c2008-05-17 18:44:45 +000017* coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit
Georg Brandl116aa622007-08-15 14:28:22 +000018
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020019* cross-platform: works on Windows, Unix, and Mac OS X
Georg Brandl116aa622007-08-15 14:28:22 +000020
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020021* multi-window text editor with multiple undo, Python colorizing,
22 smart indent, call tips, and many other features
Georg Brandl116aa622007-08-15 14:28:22 +000023
24* Python shell window (a.k.a. interactive interpreter)
25
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020026* debugger (not complete, but you can set breakpoints, view and step)
Georg Brandl116aa622007-08-15 14:28:22 +000027
28
29Menus
30-----
31
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050032IDLE has two main window types, the Shell window and the Editor window. It is
33possible to have multiple editor windows simultaneously. Output windows, such
34as used for Edit / Find in Files, are a subtype of edit window. They currently
35have the same top menu as Editor windows but a different default title and
36context menu.
37
38IDLE's menus dynamically change based on which window is currently selected.
39Each menu documented below indicates which window type it is associated with.
Georg Brandl116aa622007-08-15 14:28:22 +000040
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020041File menu (Shell and Editor)
42^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl116aa622007-08-15 14:28:22 +000043
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050044New File
45 Create a new file editing window.
Georg Brandl116aa622007-08-15 14:28:22 +000046
47Open...
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050048 Open an existing file with an Open dialog.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020049
50Recent Files
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050051 Open a list of recent files. Click one to open it.
52
53Open Module...
54 Open an existing module (searches sys.path).
Georg Brandl116aa622007-08-15 14:28:22 +000055
Terry Jan Reedyf5684942014-12-04 00:54:59 -050056.. index::
57 single: Class browser
58 single: Path browser
59
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050060Class Browser
61 Show functions, classes, and methods in the current Editor file in a
62 tree structure. In the shell, open a module first.
Georg Brandl116aa622007-08-15 14:28:22 +000063
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050064Path Browser
65 Show sys.path directories, modules, functions, classes and methods in a
66 tree structure.
Georg Brandl116aa622007-08-15 14:28:22 +000067
Georg Brandl116aa622007-08-15 14:28:22 +000068Save
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050069 Save the current window to the associated file, if there is one. Windows
70 that have been changed since being opened or last saved have a \* before
71 and after the window title. If there is no associated file,
72 do Save As instead.
Georg Brandl116aa622007-08-15 14:28:22 +000073
74Save As...
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050075 Save the current window with a Save As dialog. The file saved becomes the
76 new associated file for the window.
Georg Brandl116aa622007-08-15 14:28:22 +000077
78Save Copy As...
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050079 Save the current window to different file without changing the associated
80 file.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020081
82Print Window
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050083 Print the current window to the default printer.
Georg Brandl116aa622007-08-15 14:28:22 +000084
85Close
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050086 Close the current window (ask to save if unsaved).
Georg Brandl116aa622007-08-15 14:28:22 +000087
88Exit
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050089 Close all windows and quit IDLE (ask to save unsaved windows).
Georg Brandl116aa622007-08-15 14:28:22 +000090
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020091Edit menu (Shell and Editor)
92^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl116aa622007-08-15 14:28:22 +000093
94Undo
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050095 Undo the last change to the current window. A maximum of 1000 changes may
96 be undone.
Georg Brandl116aa622007-08-15 14:28:22 +000097
98Redo
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -050099 Redo the last undone change to the current window.
Georg Brandl116aa622007-08-15 14:28:22 +0000100
101Cut
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500102 Copy selection into the system-wide clipboard; then delete the selection.
Georg Brandl116aa622007-08-15 14:28:22 +0000103
104Copy
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500105 Copy selection into the system-wide clipboard.
Georg Brandl116aa622007-08-15 14:28:22 +0000106
107Paste
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500108 Insert contents of the system-wide clipboard into the current window.
109
110The clipboard functions are also available in context menus.
Georg Brandl116aa622007-08-15 14:28:22 +0000111
112Select All
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500113 Select the entire contents of the current window.
Georg Brandl116aa622007-08-15 14:28:22 +0000114
115Find...
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500116 Open a search dialog with many options
Georg Brandl116aa622007-08-15 14:28:22 +0000117
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500118Find Again
119 Repeat the last search, if there is one.
Georg Brandl116aa622007-08-15 14:28:22 +0000120
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500121Find Selection
122 Search for the currently selected string, if there is one.
Georg Brandl116aa622007-08-15 14:28:22 +0000123
124Find in Files...
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500125 Open a file search dialog. Put results in an new output window.
Georg Brandl116aa622007-08-15 14:28:22 +0000126
127Replace...
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500128 Open a search-and-replace dialog.
Georg Brandl116aa622007-08-15 14:28:22 +0000129
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500130Go to Line
131 Move cursor to the line number requested and make that line visible.
Georg Brandl116aa622007-08-15 14:28:22 +0000132
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500133Show Completions
134 Open a scrollable list allowing selection of keywords and attributes. See
135 Completions in the Tips sections below.
136
137Expand Word
138 Expand a prefix you have typed to match a full word in the same window;
139 repeat to get a different expansion.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200140
141Show call tip
142 After an unclosed parenthesis for a function, open a small window with
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500143 function parameter hints.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200144
145Show surrounding parens
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500146 Highlight the surrounding parenthesis.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200147
148Format menu (Editor window only)
Terry Jan Reedyf5684942014-12-04 00:54:59 -0500149^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200150
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500151Indent Region
152 Shift selected lines right by the indent width (default 4 spaces).
Georg Brandl116aa622007-08-15 14:28:22 +0000153
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500154Dedent Region
155 Shift selected lines left by the indent width (default 4 spaces).
Georg Brandl116aa622007-08-15 14:28:22 +0000156
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500157Comment Out Region
158 Insert ## in front of selected lines.
Georg Brandl116aa622007-08-15 14:28:22 +0000159
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500160Uncomment Region
161 Remove leading # or ## from selected lines.
Georg Brandl116aa622007-08-15 14:28:22 +0000162
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500163Tabify Region
164 Turn *leading* stretches of spaces into tabs. (Note: We recommend using
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200165 4 space blocks to indent Python code.)
Georg Brandl116aa622007-08-15 14:28:22 +0000166
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500167Untabify Region
168 Turn *all* tabs into the correct number of spaces.
Georg Brandl116aa622007-08-15 14:28:22 +0000169
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500170Toggle Tabs
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200171 Open a dialog to switch between indenting with spaces and tabs.
172
173New Indent Width
174 Open a dialog to change indent width. The accepted default by the Python
175 community is 4 spaces.
Georg Brandl116aa622007-08-15 14:28:22 +0000176
177Format Paragraph
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500178 Reformat the current blank-line-delimited paragraph in comment block or
179 multiline string or selected line in a string. All lines in the
180 paragraph will be formatted to less than N columns, where N defaults to 72.
Georg Brandl116aa622007-08-15 14:28:22 +0000181
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200182Strip trailing whitespace
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500183 Remove any space characters after the last non-space character of a line.
Georg Brandl116aa622007-08-15 14:28:22 +0000184
185.. index::
Georg Brandl116aa622007-08-15 14:28:22 +0000186 single: Run script
187
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200188Run menu (Editor window only)
189^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl116aa622007-08-15 14:28:22 +0000190
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200191Python Shell
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500192 Open or wake up the Python Shell window.
Georg Brandl116aa622007-08-15 14:28:22 +0000193
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500194Check Module
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200195 Check the syntax of the module currently open in the Editor window. If the
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500196 module has not been saved IDLE will either prompt the user to save or
197 autosave, as selected in the General tab of the Idle Settings dialog. If
198 there is a syntax error, the approximate location is indicated in the
199 Editor window.
Georg Brandl116aa622007-08-15 14:28:22 +0000200
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500201Run Module
202 Do Check Module (above). If no error, restart the shell to clean the
203 environment, then execute the module.
Georg Brandl116aa622007-08-15 14:28:22 +0000204
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200205Shell menu (Shell window only)
206^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Ned Deily2778d0d2012-10-20 13:25:34 -0700207
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200208View Last Restart
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500209 Scroll the shell window to the last Shell restart.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200210
211Restart Shell
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500212 Restart the shell to clean the environment.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200213
214Debug menu (Shell window only)
215^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl116aa622007-08-15 14:28:22 +0000216
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500217Go to File/Line
218 Look on the current line. with the cursor, and the line above for a filename
219 and line number. If found, open the file if not already open, and show the
220 line. Use this to view source lines referenced in an exception traceback
221 and lines found by Find in Files. Also available in the context menu of
222 the Shell window and Output windows.
Georg Brandl116aa622007-08-15 14:28:22 +0000223
224.. index::
Georg Brandl116aa622007-08-15 14:28:22 +0000225 single: debugger
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500226 single: stack viewer
227
228Debugger (toggle)
229 When actived, code entered in the Shell or run from an Editor will run
230 under the debugger. In the Editor, breakpoints can be set with the context
231 menu. This feature is still incomplete and somewhat experimental.
232
233Stack Viewer
234 Show the stack traceback of the last exception in a tree widget, with
235 access to locals and globals.
236
237Auto-open Stack Viewer
238 Toggle automatically opening the stack viewer on an unhandled exception.
Georg Brandl116aa622007-08-15 14:28:22 +0000239
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200240Options menu (Shell and Editor)
241^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl116aa622007-08-15 14:28:22 +0000242
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200243Configure IDLE
244 Open a configuration dialog. Fonts, indentation, keybindings, and color
245 themes may be altered. Startup Preferences may be set, and additional
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500246 help sources can be specified. Non-default user setting are saved in a
247 .idlerc directory in the user's home directory. Problems caused by bad user
248 configuration files are solved by editing or deleting one or more of the
Ned Deilyf1ce6de2015-07-04 15:05:07 -0700249 files in .idlerc. On OS X, open the configuration dialog by selecting
250 Preferences in the application menu.
Ned Deily2778d0d2012-10-20 13:25:34 -0700251
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500252Configure Extensions
253 Open a configuration dialog for setting preferences for extensions
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500254 (discussed below). See note above about the location of user settings.
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500255
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200256Code Context (toggle)(Editor Window only)
257 Open a pane at the top of the edit window which shows the block context
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500258 of the code which has scrolled above the top of the window.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200259
Ned Deilyccb416f2015-01-17 21:06:27 -0800260Window menu (Shell and Editor)
261^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200262
263Zoom Height
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500264 Toggles the window between normal size and maximum height. The initial size
265 defaults to 40 lines by 80 chars unless changed on the General tab of the
266 Configure IDLE dialog.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200267
268The rest of this menu lists the names of all open windows; select one to bring
269it to the foreground (deiconifying it if necessary).
270
271Help menu (Shell and Editor)
272^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273
274About IDLE
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500275 Display version, copyright, license, credits, and more.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200276
277IDLE Help
278 Display a help file for IDLE detailing the menu options, basic editing and
279 navigation, and other tips.
280
281Python Docs
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500282 Access local Python documentation, if installed, or start a web browser
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200283 and open docs.python.org showing the latest Python documentation.
284
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500285Turtle Demo
286 Run the turtledemo module with example python code and turtle drawings.
287
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200288Additional help sources may be added here with the Configure IDLE dialog under
289the General tab.
290
Terry Jan Reedyf5684942014-12-04 00:54:59 -0500291.. index::
292 single: Cut
293 single: Copy
294 single: Paste
295 single: Set Breakpoint
296 single: Clear Breakpoint
297 single: breakpoints
298
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500299Context Menus
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200300^^^^^^^^^^^^^^^^^^^^^^^^^^
301
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500302Open a context menu by right-clicking in a window (Control-click on OS X).
303Context menus have the standard clipboard functions also on the Edit menu.
Ned Deily2778d0d2012-10-20 13:25:34 -0700304
Andrew Svetlovd1837672012-11-01 22:41:19 +0200305Cut
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500306 Copy selection into the system-wide clipboard; then delete the selection.
Andrew Svetlovd1837672012-11-01 22:41:19 +0200307
308Copy
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500309 Copy selection into the system-wide clipboard.
Andrew Svetlovd1837672012-11-01 22:41:19 +0200310
311Paste
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500312 Insert contents of the system-wide clipboard into the current window.
313
314Editor windows also have breakpoint functions. Lines with a breakpoint set are
315specially marked. Breakpoints only have an effect when running under the
316debugger. Breakpoints for a file are saved in the user's .idlerc directory.
Andrew Svetlovd1837672012-11-01 22:41:19 +0200317
Ned Deily2778d0d2012-10-20 13:25:34 -0700318Set Breakpoint
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500319 Set a breakpoint on the current line.
Ned Deily2778d0d2012-10-20 13:25:34 -0700320
321Clear Breakpoint
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500322 Clear the breakpoint on that line.
Ned Deily2778d0d2012-10-20 13:25:34 -0700323
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500324Shell and Output windows have the following.
Andrew Svetlovd1837672012-11-01 22:41:19 +0200325
Ned Deily2778d0d2012-10-20 13:25:34 -0700326Go to file/line
327 Same as in Debug menu.
328
329
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200330Editing and navigation
331----------------------
Georg Brandl116aa622007-08-15 14:28:22 +0000332
Terry Jan Reedyf5684942014-12-04 00:54:59 -0500333In this section, 'C' refers to the Control key on Windows and Unix and
334the Command key on Mac OSX.
335
Georg Brandl116aa622007-08-15 14:28:22 +0000336* :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right
337
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200338* :kbd:`C-Backspace` delete word left; :kbd:`C-Del` delete word to the right
339
Georg Brandl116aa622007-08-15 14:28:22 +0000340* Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around
341
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200342* :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves by words
343
Georg Brandl116aa622007-08-15 14:28:22 +0000344* :kbd:`Home`/:kbd:`End` go to begin/end of line
345
346* :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file
347
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200348* Some useful Emacs bindings are inherited from Tcl/Tk:
349
350 * :kbd:`C-a` beginning of line
351
352 * :kbd:`C-e` end of line
353
354 * :kbd:`C-k` kill line (but doesn't put it in clipboard)
355
356 * :kbd:`C-l` center window around the insertion point
357
358 * :kbd:`C-b` go backwards one character without deleting (usually you can
359 also use the cursor key for this)
360
361 * :kbd:`C-f` go forward one character without deleting (usually you can
362 also use the cursor key for this)
363
364 * :kbd:`C-p` go up one line (usually you can also use the cursor key for
365 this)
366
367 * :kbd:`C-d` delete next character
368
369Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste)
370may work. Keybindings are selected in the Configure IDLE dialog.
Georg Brandl116aa622007-08-15 14:28:22 +0000371
372
373Automatic indentation
374^^^^^^^^^^^^^^^^^^^^^
375
376After a block-opening statement, the next line is indented by 4 spaces (in the
377Python Shell window by one tab). After certain keywords (break, return etc.)
378the next line is dedented. In leading indentation, :kbd:`Backspace` deletes up
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200379to 4 spaces if they are there. :kbd:`Tab` inserts spaces (in the Python
380Shell window one tab), number depends on Indent width. Currently tabs
381are restricted to four spaces due to Tcl/Tk limitations.
Georg Brandl116aa622007-08-15 14:28:22 +0000382
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200383See also the indent/dedent region commands in the edit menu.
384
385Completions
386^^^^^^^^^^^
387
388Completions are supplied for functions, classes, and attributes of classes,
389both built-in and user-defined. Completions are also provided for
390filenames.
391
392The AutoCompleteWindow (ACW) will open after a predefined delay (default is
393two seconds) after a '.' or (in a string) an os.sep is typed. If after one
394of those characters (plus zero or more other characters) a tab is typed
395the ACW will open immediately if a possible continuation is found.
396
397If there is only one possible completion for the characters entered, a
398:kbd:`Tab` will supply that completion without opening the ACW.
399
400'Show Completions' will force open a completions window, by default the
401:kbd:`C-space` will open a completions window. In an empty
402string, this will contain the files in the current directory. On a
403blank line, it will contain the built-in and user-defined functions and
404classes in the current name spaces, plus any modules imported. If some
405characters have been entered, the ACW will attempt to be more specific.
406
407If a string of characters is typed, the ACW selection will jump to the
408entry most closely matching those characters. Entering a :kbd:`tab` will
409cause the longest non-ambiguous match to be entered in the Editor window or
410Shell. Two :kbd:`tab` in a row will supply the current ACW selection, as
411will return or a double click. Cursor keys, Page Up/Down, mouse selection,
412and the scroll wheel all operate on the ACW.
413
414"Hidden" attributes can be accessed by typing the beginning of hidden
415name after a '.', e.g. '_'. This allows access to modules with
416``__all__`` set, or to class-private attributes.
417
418Completions and the 'Expand Word' facility can save a lot of typing!
419
420Completions are currently limited to those in the namespaces. Names in
421an Editor window which are not via ``__main__`` and :data:`sys.modules` will
422not be found. Run the module once with your imports to correct this situation.
423Note that IDLE itself places quite a few modules in sys.modules, so
424much can be found by default, e.g. the re module.
425
426If you don't like the ACW popping up unbidden, simply make the delay
427longer or disable the extension. Or another option is the delay could
428be set to zero. Another alternative to preventing ACW popups is to
429disable the call tips extension.
Georg Brandl116aa622007-08-15 14:28:22 +0000430
431Python Shell window
432^^^^^^^^^^^^^^^^^^^
433
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200434* :kbd:`C-c` interrupts executing command
Georg Brandl116aa622007-08-15 14:28:22 +0000435
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200436* :kbd:`C-d` sends end-of-file; closes window if typed at a ``>>>`` prompt
Georg Brandl116aa622007-08-15 14:28:22 +0000437
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200438* :kbd:`Alt-/` (Expand word) is also useful to reduce typing
Georg Brandl116aa622007-08-15 14:28:22 +0000439
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200440 Command history
Georg Brandl116aa622007-08-15 14:28:22 +0000441
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200442 * :kbd:`Alt-p` retrieves previous command matching what you have typed. On
443 OS X use :kbd:`C-p`.
Georg Brandl116aa622007-08-15 14:28:22 +0000444
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200445 * :kbd:`Alt-n` retrieves next. On OS X use :kbd:`C-n`.
Georg Brandl116aa622007-08-15 14:28:22 +0000446
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200447 * :kbd:`Return` while on any previous command retrieves that command
Georg Brandl116aa622007-08-15 14:28:22 +0000448
449
450Syntax colors
451-------------
452
453The coloring is applied in a background "thread," so you may occasionally see
454uncolorized text. To change the color scheme, edit the ``[Colors]`` section in
455:file:`config.txt`.
456
457Python syntax colors:
458 Keywords
459 orange
460
Georg Brandl48310cd2009-01-03 21:18:54 +0000461 Strings
Georg Brandl116aa622007-08-15 14:28:22 +0000462 green
463
464 Comments
465 red
466
467 Definitions
468 blue
469
470Shell colors:
471 Console output
472 brown
473
474 stdout
475 blue
476
477 stderr
478 dark green
479
480 stdin
481 black
482
483
Benjamin Petersonf07d0022009-03-21 17:31:58 +0000484Startup
485-------
486
487Upon startup with the ``-s`` option, IDLE will execute the file referenced by
488the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200489IDLE first checks for ``IDLESTARTUP``; if ``IDLESTARTUP`` is present the file
490referenced is run. If ``IDLESTARTUP`` is not present, IDLE checks for
Benjamin Petersonf07d0022009-03-21 17:31:58 +0000491``PYTHONSTARTUP``. Files referenced by these environment variables are
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200492convenient places to store functions that are used frequently from the IDLE
Benjamin Petersonf07d0022009-03-21 17:31:58 +0000493shell, or for executing import statements to import common modules.
494
495In addition, ``Tk`` also loads a startup file if it is present. Note that the
496Tk file is loaded unconditionally. This additional file is ``.Idle.py`` and is
497looked for in the user's home directory. Statements in this file will be
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500498executed in the Tk namespace, so this file is not useful for importing
499functions to be used from IDLE's Python shell.
Benjamin Petersonf07d0022009-03-21 17:31:58 +0000500
501
Georg Brandl116aa622007-08-15 14:28:22 +0000502Command line usage
503^^^^^^^^^^^^^^^^^^
504
505::
506
507 idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
508
509 -c command run this command
510 -d enable debugger
511 -e edit mode; arguments are files to be edited
512 -s run $IDLESTARTUP or $PYTHONSTARTUP first
513 -t title set title of shell window
514
515If there are arguments:
516
Éric Araujo713d3032010-11-18 16:38:46 +0000517#. If ``-e`` is used, arguments are files opened for editing and
Georg Brandl116aa622007-08-15 14:28:22 +0000518 ``sys.argv`` reflects the arguments passed to IDLE itself.
519
Éric Araujo713d3032010-11-18 16:38:46 +0000520#. Otherwise, if ``-c`` is used, all arguments are placed in
Georg Brandl116aa622007-08-15 14:28:22 +0000521 ``sys.argv[1:...]``, with ``sys.argv[0]`` set to ``'-c'``.
522
Éric Araujo713d3032010-11-18 16:38:46 +0000523#. Otherwise, if neither ``-e`` nor ``-c`` is used, the first
Georg Brandl116aa622007-08-15 14:28:22 +0000524 argument is a script which is executed with the remaining arguments in
Terry Jan Reedy3ab745e2014-12-05 02:43:07 -0500525 ``sys.argv[1:...]`` and ``sys.argv[0]`` set to the script name. If the
526 script name is '-', no script is executed but an interactive Python session
527 is started; the arguments are still available in ``sys.argv``.
Georg Brandl116aa622007-08-15 14:28:22 +0000528
Terry Jan Reedyf5684942014-12-04 00:54:59 -0500529Running without a subprocess
530^^^^^^^^^^^^^^^^^^^^^^^^^^^^
531
532If IDLE is started with the -n command line switch it will run in a
533single process and will not create the subprocess which runs the RPC
534Python execution server. This can be useful if Python cannot create
535the subprocess or the RPC socket interface on your platform. However,
536in this mode user code is not isolated from IDLE itself. Also, the
537environment is not restarted when Run/Run Module (F5) is selected. If
538your code has been modified, you must reload() the affected modules and
539re-import any specific items (e.g. from foo import baz) if the changes
540are to take effect. For these reasons, it is preferable to run IDLE
541with the default subprocess if at all possible.
542
543.. deprecated:: 3.4
544
Georg Brandl116aa622007-08-15 14:28:22 +0000545
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500546Help and preferences
547--------------------
548
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200549Additional help sources
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500550^^^^^^^^^^^^^^^^^^^^^^^
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200551
552IDLE includes a help menu entry called "Python Docs" that will open the
553extensive sources of help, including tutorials, available at docs.python.org.
554Selected URLs can be added or removed from the help menu at any time using the
555Configure IDLE dialog. See the IDLE help option in the help menu of IDLE for
556more information.
557
558
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500559Setting preferences
560^^^^^^^^^^^^^^^^^^^
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200561
562The font preferences, highlighting, keys, and general preferences can be
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500563changed via Configure IDLE on the Option menu. Keys can be user defined;
564IDLE ships with four built in key sets. In addition a user can create a
565custom key set in the Configure IDLE dialog under the keys tab.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200566
Terry Jan Reedyf5684942014-12-04 00:54:59 -0500567
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200568Extensions
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500569^^^^^^^^^^
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200570
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500571IDLE contains an extension facility. Peferences for extensions can be
572changed with Configure Extensions. See the beginning of config-extensions.def
573in the idlelib directory for further information. The default extensions
574are currently:
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200575
576* FormatParagraph
577
578* AutoExpand
579
580* ZoomHeight
581
582* ScriptBinding
583
584* CallTips
585
586* ParenMatch
587
588* AutoComplete
589
590* CodeContext
591
Terry Jan Reedybb37b4c2014-12-04 01:26:04 -0500592* RstripExtension