blob: e9a91aed506686c99801deacefa7d8def6f2873f [file] [log] [blame]
Georg Brandl8ec7f652007-08-15 14:28:01 +00001.. _idle:
2
Georg Brandl8ec7f652007-08-15 14:28:01 +00003.. index::
Georg Brandlb19be572007-12-29 10:57:00 +00004 single: IDLE
Georg Brandl8ec7f652007-08-15 14:28:01 +00005 single: Python Editor
6 single: Integrated Development Environment
7
Terry Jan Reedyeb405892014-12-04 00:55:46 -05008IDLE
9====
10
11.. moduleauthor:: Guido van Rossum <guido@Python.org>
12
Georg Brandlc21cd7e2008-05-16 17:37:53 +000013IDLE is the Python IDE built with the :mod:`tkinter` GUI toolkit.
Georg Brandl8ec7f652007-08-15 14:28:01 +000014
15IDLE has the following features:
16
Georg Brandlc21cd7e2008-05-16 17:37:53 +000017* coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit
Georg Brandl8ec7f652007-08-15 14:28:01 +000018
Terry Jan Reedyeb405892014-12-04 00:55:46 -050019* cross-platform: works on Windows, Unix, and Mac OS X
Georg Brandl8ec7f652007-08-15 14:28:01 +000020
Terry Jan Reedyeb405892014-12-04 00:55:46 -050021* multi-window text editor with multiple undo, Python colorizing,
22 smart indent, call tips, and many other features
Georg Brandl8ec7f652007-08-15 14:28:01 +000023
24* Python shell window (a.k.a. interactive interpreter)
25
Terry Jan Reedyeb405892014-12-04 00:55:46 -050026* debugger (not complete, but you can set breakpoints, view and step)
Georg Brandl8ec7f652007-08-15 14:28:01 +000027
28
29Menus
30-----
31
Terry Jan Reedybafef5a2014-12-05 02:42:54 -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.
40Click on the dotted line at the top of a menu to "tear it off": a separate
41window containing the menu is created (for Unix and Windows only).
Georg Brandl8ec7f652007-08-15 14:28:01 +000042
Terry Jan Reedyeb405892014-12-04 00:55:46 -050043File menu (Shell and Editor)
44^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl8ec7f652007-08-15 14:28:01 +000045
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050046New File
47 Create a new file editing window.
Georg Brandl8ec7f652007-08-15 14:28:01 +000048
49Open...
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050050 Open an existing file with an Open dialog.
Georg Brandl8ec7f652007-08-15 14:28:01 +000051
Terry Jan Reedyeb405892014-12-04 00:55:46 -050052Recent Files
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050053 Open a list of recent files. Click one to open it.
54
55Open Module...
56 Open an existing module (searches sys.path).
Georg Brandl8ec7f652007-08-15 14:28:01 +000057
58.. index::
59 single: Class browser
60 single: Path browser
61
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050062Class Browser
63 Show functions, classes, and methods in the current Editor file in a
64 tree structure. In the shell, open a module first.
Terry Jan Reedyeb405892014-12-04 00:55:46 -050065
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050066Path Browser
67 Show sys.path directories, modules, functions, classes and methods in a
68 tree structure.
Terry Jan Reedyeb405892014-12-04 00:55:46 -050069
Georg Brandl8ec7f652007-08-15 14:28:01 +000070Save
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050071 Save the current window to the associated file, if there is one. Windows
72 that have been changed since being opened or last saved have a \* before
73 and after the window title. If there is no associated file,
74 do Save As instead.
Georg Brandl8ec7f652007-08-15 14:28:01 +000075
76Save As...
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050077 Save the current window with a Save As dialog. The file saved becomes the
78 new associated file for the window.
Georg Brandl8ec7f652007-08-15 14:28:01 +000079
80Save Copy As...
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050081 Save the current window to different file without changing the associated
82 file.
Terry Jan Reedyeb405892014-12-04 00:55:46 -050083
84Print Window
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050085 Print the current window to the default printer.
Georg Brandl8ec7f652007-08-15 14:28:01 +000086
87Close
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050088 Close the current window (ask to save if unsaved).
Georg Brandl8ec7f652007-08-15 14:28:01 +000089
90Exit
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050091 Close all windows and quit IDLE (ask to save unsaved windows).
Georg Brandl8ec7f652007-08-15 14:28:01 +000092
Terry Jan Reedyeb405892014-12-04 00:55:46 -050093Edit menu (Shell and Editor)
94^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl8ec7f652007-08-15 14:28:01 +000095
96Undo
Terry Jan Reedybafef5a2014-12-05 02:42:54 -050097 Undo the last change to the current window. A maximum of 1000 changes may
98 be undone.
Georg Brandl8ec7f652007-08-15 14:28:01 +000099
100Redo
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500101 Redo the last undone change to the current window.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000102
103Cut
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500104 Copy selection into the system-wide clipboard; then delete the selection.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000105
106Copy
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500107 Copy selection into the system-wide clipboard.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000108
109Paste
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500110 Insert contents of the system-wide clipboard into the current window.
111
112The clipboard functions are also available in context menus.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000113
114Select All
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500115 Select the entire contents of the current window.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000116
117Find...
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500118 Open a search dialog with many options
Georg Brandl8ec7f652007-08-15 14:28:01 +0000119
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500120Find Again
121 Repeat the last search, if there is one.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000122
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500123Find Selection
124 Search for the currently selected string, if there is one.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000125
126Find in Files...
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500127 Open a file search dialog. Put results in an new output window.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000128
129Replace...
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500130 Open a search-and-replace dialog.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000131
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500132Go to Line
133 Move cursor to the line number requested and make that line visible.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000134
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500135Show Completions
136 Open a scrollable list allowing selection of keywords and attributes. See
137 Completions in the Tips sections below.
138
139Expand Word
140 Expand a prefix you have typed to match a full word in the same window;
141 repeat to get a different expansion.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500142
143Show call tip
144 After an unclosed parenthesis for a function, open a small window with
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500145 function parameter hints.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500146
147Show surrounding parens
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500148 Highlight the surrounding parenthesis.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500149
150Format menu (Editor window only)
151^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500153Indent Region
154 Shift selected lines right by the indent width (default 4 spaces).
Georg Brandl8ec7f652007-08-15 14:28:01 +0000155
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500156Dedent Region
157 Shift selected lines left by the indent width (default 4 spaces).
Georg Brandl8ec7f652007-08-15 14:28:01 +0000158
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500159Comment Out Region
160 Insert ## in front of selected lines.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000161
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500162Uncomment Region
163 Remove leading # or ## from selected lines.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000164
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500165Tabify Region
166 Turn *leading* stretches of spaces into tabs. (Note: We recommend using
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500167 4 space blocks to indent Python code.)
Georg Brandl8ec7f652007-08-15 14:28:01 +0000168
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500169Untabify Region
170 Turn *all* tabs into the correct number of spaces.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000171
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500172Toggle Tabs
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500173 Open a dialog to switch between indenting with spaces and tabs.
174
175New Indent Width
176 Open a dialog to change indent width. The accepted default by the Python
177 community is 4 spaces.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000178
179Format Paragraph
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500180 Reformat the current blank-line-delimited paragraph in comment block or
181 multiline string or selected line in a string. All lines in the
182 paragraph will be formatted to less than N columns, where N defaults to 72.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000183
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500184Strip trailing whitespace
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500185 Remove any space characters after the last non-space character of a line.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000186
187.. index::
Georg Brandl8ec7f652007-08-15 14:28:01 +0000188 single: Run script
189
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500190Run menu (Editor window only)
191^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl8ec7f652007-08-15 14:28:01 +0000192
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500193Python Shell
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500194 Open or wake up the Python Shell window.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000195
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500196Check Module
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500197 Check the syntax of the module currently open in the Editor window. If the
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500198 module has not been saved IDLE will either prompt the user to save or
199 autosave, as selected in the General tab of the Idle Settings dialog. If
200 there is a syntax error, the approximate location is indicated in the
201 Editor window.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000202
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500203Run Module
204 Do Check Module (above). If no error, restart the shell to clean the
205 environment, then execute the module.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000206
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500207Shell menu (Shell window only)
208^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Ned Deilyc859bd22012-10-20 13:23:25 -0700209
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500210View Last Restart
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500211 Scroll the shell window to the last Shell restart.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500212
213Restart Shell
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500214 Restart the shell to clean the environment.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500215
216Debug menu (Shell window only)
217^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl8ec7f652007-08-15 14:28:01 +0000218
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500219Go to File/Line
220 Look on the current line. with the cursor, and the line above for a filename
221 and line number. If found, open the file if not already open, and show the
222 line. Use this to view source lines referenced in an exception traceback
223 and lines found by Find in Files. Also available in the context menu of
224 the Shell window and Output windows.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000225
226.. index::
Georg Brandl8ec7f652007-08-15 14:28:01 +0000227 single: debugger
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500228 single: stack viewer
229
230Debugger (toggle)
231 When actived, code entered in the Shell or run from an Editor will run
232 under the debugger. In the Editor, breakpoints can be set with the context
233 menu. This feature is still incomplete and somewhat experimental.
234
235Stack Viewer
236 Show the stack traceback of the last exception in a tree widget, with
237 access to locals and globals.
238
239Auto-open Stack Viewer
240 Toggle automatically opening the stack viewer on an unhandled exception.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000241
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500242Options menu (Shell and Editor)
243^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Georg Brandl8ec7f652007-08-15 14:28:01 +0000244
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500245Configure IDLE
246 Open a configuration dialog. Fonts, indentation, keybindings, and color
247 themes may be altered. Startup Preferences may be set, and additional
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500248 help sources can be specified. Non-default user setting are saved in a
249 .idlerc directory in the user's home directory. Problems caused by bad user
250 configuration files are solved by editing or deleting one or more of the
251 files in .idlerc.
Ned Deilyc859bd22012-10-20 13:23:25 -0700252
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500253Configure Extensions
254 Open a configuration dialog for setting preferences for extensions
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500255 (discussed below). See note above about the location of user settings.
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500256
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500257Code Context (toggle)(Editor Window only)
258 Open a pane at the top of the edit window which shows the block context
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500259 of the code which has scrolled above the top of the window.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500260
261Windows menu (Shell and Editor)
262^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
263
264Zoom Height
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500265 Toggles the window between normal size and maximum height. The initial size
266 defaults to 40 lines by 80 chars unless changed on the General tab of the
267 Configure IDLE dialog.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500268
269The rest of this menu lists the names of all open windows; select one to bring
270it to the foreground (deiconifying it if necessary).
271
272Help menu (Shell and Editor)
273^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274
275About IDLE
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500276 Display version, copyright, license, credits, and more.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500277
278IDLE Help
279 Display a help file for IDLE detailing the menu options, basic editing and
280 navigation, and other tips.
281
282Python Docs
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500283 Access local Python documentation, if installed, or start a web browser
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500284 and open docs.python.org showing the latest Python documentation.
285
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500286Turtle Demo
287 Run the turtledemo module with example python code and turtle drawings.
288
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500289Additional help sources may be added here with the Configure IDLE dialog under
290the General tab.
291
292.. index::
293 single: Cut
294 single: Copy
295 single: Paste
296 single: Set Breakpoint
297 single: Clear Breakpoint
298 single: breakpoints
299
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500300Context Menus
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500301^^^^^^^^^^^^^^^^^^^^^^^^^^
302
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500303Open a context menu by right-clicking in a window (Control-click on OS X).
304Context menus have the standard clipboard functions also on the Edit menu.
Ned Deilyc859bd22012-10-20 13:23:25 -0700305
Andrew Svetlov5018db72012-11-01 22:39:14 +0200306Cut
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500307 Copy selection into the system-wide clipboard; then delete the selection.
Andrew Svetlov5018db72012-11-01 22:39:14 +0200308
309Copy
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500310 Copy selection into the system-wide clipboard.
Andrew Svetlov5018db72012-11-01 22:39:14 +0200311
312Paste
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500313 Insert contents of the system-wide clipboard into the current window.
314
315Editor windows also have breakpoint functions. Lines with a breakpoint set are
316specially marked. Breakpoints only have an effect when running under the
317debugger. Breakpoints for a file are saved in the user's .idlerc directory.
Andrew Svetlov5018db72012-11-01 22:39:14 +0200318
Ned Deilyc859bd22012-10-20 13:23:25 -0700319Set Breakpoint
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500320 Set a breakpoint on the current line.
Ned Deilyc859bd22012-10-20 13:23:25 -0700321
322Clear Breakpoint
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500323 Clear the breakpoint on that line.
Ned Deilyc859bd22012-10-20 13:23:25 -0700324
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500325Shell and Output windows have the following.
Andrew Svetlov5018db72012-11-01 22:39:14 +0200326
Ned Deilyc859bd22012-10-20 13:23:25 -0700327Go to file/line
328 Same as in Debug menu.
329
330
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500331Editing and navigation
332----------------------
333
334In this section, 'C' refers to the Control key on Windows and Unix and
335the Command key on Mac OSX.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000336
337* :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right
338
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500339* :kbd:`C-Backspace` delete word left; :kbd:`C-Del` delete word to the right
340
Georg Brandl8ec7f652007-08-15 14:28:01 +0000341* Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around
342
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500343* :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves by words
344
Georg Brandl8ec7f652007-08-15 14:28:01 +0000345* :kbd:`Home`/:kbd:`End` go to begin/end of line
346
347* :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file
348
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500349* Some useful Emacs bindings are inherited from Tcl/Tk:
350
351 * :kbd:`C-a` beginning of line
352
353 * :kbd:`C-e` end of line
354
355 * :kbd:`C-k` kill line (but doesn't put it in clipboard)
356
357 * :kbd:`C-l` center window around the insertion point
358
359 * :kbd:`C-b` go backwards one character without deleting (usually you can
360 also use the cursor key for this)
361
362 * :kbd:`C-f` go forward one character without deleting (usually you can
363 also use the cursor key for this)
364
365 * :kbd:`C-p` go up one line (usually you can also use the cursor key for
366 this)
367
368 * :kbd:`C-d` delete next character
369
370Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste)
371may work. Keybindings are selected in the Configure IDLE dialog.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000372
373
374Automatic indentation
375^^^^^^^^^^^^^^^^^^^^^
376
377After a block-opening statement, the next line is indented by 4 spaces (in the
378Python Shell window by one tab). After certain keywords (break, return etc.)
379the next line is dedented. In leading indentation, :kbd:`Backspace` deletes up
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500380to 4 spaces if they are there. :kbd:`Tab` inserts spaces (in the Python
381Shell window one tab), number depends on Indent width. Currently tabs
382are restricted to four spaces due to Tcl/Tk limitations.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000383
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500384See also the indent/dedent region commands in the edit menu.
385
386Completions
387^^^^^^^^^^^
388
389Completions are supplied for functions, classes, and attributes of classes,
390both built-in and user-defined. Completions are also provided for
391filenames.
392
393The AutoCompleteWindow (ACW) will open after a predefined delay (default is
394two seconds) after a '.' or (in a string) an os.sep is typed. If after one
395of those characters (plus zero or more other characters) a tab is typed
396the ACW will open immediately if a possible continuation is found.
397
398If there is only one possible completion for the characters entered, a
399:kbd:`Tab` will supply that completion without opening the ACW.
400
401'Show Completions' will force open a completions window, by default the
402:kbd:`C-space` will open a completions window. In an empty
403string, this will contain the files in the current directory. On a
404blank line, it will contain the built-in and user-defined functions and
405classes in the current name spaces, plus any modules imported. If some
406characters have been entered, the ACW will attempt to be more specific.
407
408If a string of characters is typed, the ACW selection will jump to the
409entry most closely matching those characters. Entering a :kbd:`tab` will
410cause the longest non-ambiguous match to be entered in the Editor window or
411Shell. Two :kbd:`tab` in a row will supply the current ACW selection, as
412will return or a double click. Cursor keys, Page Up/Down, mouse selection,
413and the scroll wheel all operate on the ACW.
414
415"Hidden" attributes can be accessed by typing the beginning of hidden
416name after a '.', e.g. '_'. This allows access to modules with
417``__all__`` set, or to class-private attributes.
418
419Completions and the 'Expand Word' facility can save a lot of typing!
420
421Completions are currently limited to those in the namespaces. Names in
422an Editor window which are not via ``__main__`` and :data:`sys.modules` will
423not be found. Run the module once with your imports to correct this situation.
424Note that IDLE itself places quite a few modules in sys.modules, so
425much can be found by default, e.g. the re module.
426
427If you don't like the ACW popping up unbidden, simply make the delay
428longer or disable the extension. Or another option is the delay could
429be set to zero. Another alternative to preventing ACW popups is to
430disable the call tips extension.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000431
432Python Shell window
433^^^^^^^^^^^^^^^^^^^
434
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500435* :kbd:`C-c` interrupts executing command
Georg Brandl8ec7f652007-08-15 14:28:01 +0000436
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500437* :kbd:`C-d` sends end-of-file; closes window if typed at a ``>>>`` prompt
Georg Brandl8ec7f652007-08-15 14:28:01 +0000438
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500439* :kbd:`Alt-/` (Expand word) is also useful to reduce typing
Georg Brandl8ec7f652007-08-15 14:28:01 +0000440
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500441 Command history
Georg Brandl8ec7f652007-08-15 14:28:01 +0000442
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500443 * :kbd:`Alt-p` retrieves previous command matching what you have typed. On
444 OS X use :kbd:`C-p`.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000445
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500446 * :kbd:`Alt-n` retrieves next. On OS X use :kbd:`C-n`.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000447
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500448 * :kbd:`Return` while on any previous command retrieves that command
Georg Brandl8ec7f652007-08-15 14:28:01 +0000449
450
451Syntax colors
452-------------
453
454The coloring is applied in a background "thread," so you may occasionally see
455uncolorized text. To change the color scheme, edit the ``[Colors]`` section in
456:file:`config.txt`.
457
458Python syntax colors:
459 Keywords
460 orange
461
Georg Brandlc62ef8b2009-01-03 20:55:06 +0000462 Strings
Georg Brandl8ec7f652007-08-15 14:28:01 +0000463 green
464
465 Comments
466 red
467
468 Definitions
469 blue
470
471Shell colors:
472 Console output
473 brown
474
475 stdout
476 blue
477
478 stderr
479 dark green
480
481 stdin
482 black
483
484
Georg Brandl09827eb2009-03-15 21:51:48 +0000485Startup
486-------
487
488Upon startup with the ``-s`` option, IDLE will execute the file referenced by
489the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500490IDLE first checks for ``IDLESTARTUP``; if ``IDLESTARTUP`` is present the file
491referenced is run. If ``IDLESTARTUP`` is not present, IDLE checks for
Georg Brandl09827eb2009-03-15 21:51:48 +0000492``PYTHONSTARTUP``. Files referenced by these environment variables are
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500493convenient places to store functions that are used frequently from the IDLE
Georg Brandl09827eb2009-03-15 21:51:48 +0000494shell, or for executing import statements to import common modules.
495
496In addition, ``Tk`` also loads a startup file if it is present. Note that the
497Tk file is loaded unconditionally. This additional file is ``.Idle.py`` and is
498looked for in the user's home directory. Statements in this file will be
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500499executed in the Tk namespace, so this file is not useful for importing
500functions to be used from IDLE's Python shell.
Georg Brandl09827eb2009-03-15 21:51:48 +0000501
502
Georg Brandl8ec7f652007-08-15 14:28:01 +0000503Command line usage
504^^^^^^^^^^^^^^^^^^
505
506::
507
508 idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
509
510 -c command run this command
511 -d enable debugger
512 -e edit mode; arguments are files to be edited
513 -s run $IDLESTARTUP or $PYTHONSTARTUP first
514 -t title set title of shell window
515
516If there are arguments:
517
Éric Araujoa8132ec2010-12-16 03:53:53 +0000518#. If ``-e`` is used, arguments are files opened for editing and
Georg Brandl8ec7f652007-08-15 14:28:01 +0000519 ``sys.argv`` reflects the arguments passed to IDLE itself.
520
Éric Araujoa8132ec2010-12-16 03:53:53 +0000521#. Otherwise, if ``-c`` is used, all arguments are placed in
Georg Brandl8ec7f652007-08-15 14:28:01 +0000522 ``sys.argv[1:...]``, with ``sys.argv[0]`` set to ``'-c'``.
523
Éric Araujoa8132ec2010-12-16 03:53:53 +0000524#. Otherwise, if neither ``-e`` nor ``-c`` is used, the first
Georg Brandl8ec7f652007-08-15 14:28:01 +0000525 argument is a script which is executed with the remaining arguments in
Terry Jan Reedybafef5a2014-12-05 02:42:54 -0500526 ``sys.argv[1:...]`` and ``sys.argv[0]`` set to the script name. If the
527 script name is '-', no script is executed but an interactive Python session
528 is started; the arguments are still available in ``sys.argv``.
Georg Brandl8ec7f652007-08-15 14:28:01 +0000529
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500530Running without a subprocess
531^^^^^^^^^^^^^^^^^^^^^^^^^^^^
532
533If IDLE is started with the -n command line switch it will run in a
534single process and will not create the subprocess which runs the RPC
535Python execution server. This can be useful if Python cannot create
536the subprocess or the RPC socket interface on your platform. However,
537in this mode user code is not isolated from IDLE itself. Also, the
538environment is not restarted when Run/Run Module (F5) is selected. If
539your code has been modified, you must reload() the affected modules and
540re-import any specific items (e.g. from foo import baz) if the changes
541are to take effect. For these reasons, it is preferable to run IDLE
542with the default subprocess if at all possible.
543
544.. deprecated:: 3.4
545
546
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500547Help and preferences
548--------------------
549
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500550Additional help sources
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500551^^^^^^^^^^^^^^^^^^^^^^^
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500552
553IDLE includes a help menu entry called "Python Docs" that will open the
554extensive sources of help, including tutorials, available at docs.python.org.
555Selected URLs can be added or removed from the help menu at any time using the
556Configure IDLE dialog. See the IDLE help option in the help menu of IDLE for
557more information.
558
559
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500560Setting preferences
561^^^^^^^^^^^^^^^^^^^
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500562
563The font preferences, highlighting, keys, and general preferences can be
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500564changed via Configure IDLE on the Option menu. Keys can be user defined;
565IDLE ships with four built in key sets. In addition a user can create a
566custom key set in the Configure IDLE dialog under the keys tab.
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500567
568
569Extensions
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500570^^^^^^^^^^
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500571
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500572IDLE contains an extension facility. Peferences for extensions can be
573changed with Configure Extensions. See the beginning of config-extensions.def
574in the idlelib directory for further information. The default extensions
575are currently:
Terry Jan Reedyeb405892014-12-04 00:55:46 -0500576
577* FormatParagraph
578
579* AutoExpand
580
581* ZoomHeight
582
583* ScriptBinding
584
585* CallTips
586
587* ParenMatch
588
589* AutoComplete
590
591* CodeContext
Georg Brandl8ec7f652007-08-15 14:28:01 +0000592
Terry Jan Reedy9e466cf2014-12-04 01:22:41 -0500593* RstripExtension