blob: 89fbe0b41ec5ff64e46a9e5107dfaa4ad2d3ef99 [file] [log] [blame]
Terry Jan Reedy5d46ab12015-09-20 19:57:13 -04001This file, idlelib/help.txt is out-of-date and no longer used by Idle.
2It is deprecated and will be removed in the future, possibly in 3.6
3----------------------------------------------------------------------
4
Kurt B. Kaiser6fa09112003-01-14 22:06:11 +00005[See the end of this file for ** TIPS ** on using IDLE !!]
David Scherer7aced172000-08-15 01:13:23 +00006
Andrew Svetlov1bd7f022013-01-14 19:27:36 +02007IDLE is the Python IDE built with the tkinter GUI toolkit.
David Scherer7aced172000-08-15 01:13:23 +00008
Andrew Svetlov1bd7f022013-01-14 19:27:36 +02009IDLE has the following features:
10-coded in 100% pure Python, using the tkinter GUI toolkit
11-cross-platform: works on Windows, Unix, and OS X
12-multi-window text editor with multiple undo, Python colorizing, smart indent,
13call tips, and many other features
14-Python shell window (a.k.a interactive interpreter)
15-debugger (not complete, but you can set breakpoints, view and step)
David Scherer7aced172000-08-15 01:13:23 +000016
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020017Menus:
18
19IDLE has two window types the Shell window and the Editor window. It is
20possible to have multiple editor windows simultaneously. IDLE's
21menus dynamically change based on which window is currently selected. Each menu
Terry Jan Reedy30f1f672015-07-30 16:44:22 -040022documented below indicates which window type it is associated with.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020023
24File Menu (Shell and Editor):
25
Terry Jan Reedyec4bdac2013-07-01 00:52:18 -040026 New File -- Create a new file editing window
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020027 Open... -- Open an existing file
28 Open Module... -- Open an existing module (searches sys.path)
29 Recent Files... -- Open a list of recent files
30 Class Browser -- Show classes and methods in current file
31 Path Browser -- Show sys.path directories, modules, classes,
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +000032 and methods
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020033 ---
34 Save -- Save current window to the associated file (unsaved
35 windows have a * before and after the window title)
David Scherer7aced172000-08-15 01:13:23 +000036
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020037 Save As... -- Save current window to new file, which becomes
38 the associated file
39 Save Copy As... -- Save current window to different file
40 without changing the associated file
41 ---
42 Print Window -- Print the current window
43 ---
44 Close -- Close current window (asks to save if unsaved)
45 Exit -- Close all windows, quit (asks to save if unsaved)
David Scherer7aced172000-08-15 01:13:23 +000046
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020047Edit Menu (Shell and Editor):
David Scherer7aced172000-08-15 01:13:23 +000048
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020049 Undo -- Undo last change to current window
50 (a maximum of 1000 changes may be undone)
51 Redo -- Redo last undone change to current window
52 ---
53 Cut -- Copy a selection into system-wide clipboard,
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +000054 then delete the selection
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020055 Copy -- Copy selection into system-wide clipboard
56 Paste -- Insert system-wide clipboard into window
57 Select All -- Select the entire contents of the edit buffer
58 ---
59 Find... -- Open a search dialog box with many options
60 Find Again -- Repeat last search
61 Find Selection -- Search for the string in the selection
62 Find in Files... -- Open a search dialog box for searching files
63 Replace... -- Open a search-and-replace dialog box
64 Go to Line -- Ask for a line number and show that line
65 Expand Word -- Expand the word you have typed to match another
66 word in the same buffer; repeat to get a
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +000067 different expansion
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020068 Show Calltip -- After an unclosed parenthesis for a function, open
69 a small window with function parameter hints
70 Show Parens -- Highlight the surrounding parenthesis
71 Show Completions -- Open a scroll window allowing selection keywords
72 and attributes. (see '*TIPS*', below)
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +000073
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020074Format Menu (Editor window only):
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +000075
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020076 Indent Region -- Shift selected lines right by the indent width
77 (default 4 spaces)
78 Dedent Region -- Shift selected lines left by the indent width
79 (default 4 spaces)
80 Comment Out Region -- Insert ## in front of selected lines
81 Uncomment Region -- Remove leading # or ## from selected lines
82 Tabify Region -- Turns *leading* stretches of spaces into tabs.
83 (Note: We recommend using 4 space blocks to indent Python code.)
84 Untabify Region -- Turn *all* tabs into the corrent number of spaces
85 Toggle tabs -- Open a dialog to switch between indenting with
86 spaces and tabs.
87 New Indent Width... -- Open a dialog to change indent width. The
88 accepted default by the Python community is 4
89 spaces.
90 Format Paragraph -- Reformat the current blank-line-separated
91 paragraph. All lines in the paragraph will be
92 formatted to less than 80 columns.
93 ---
94 Strip trailing whitespace -- Removed any space characters after the end
95 of the last non-space character
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +000096
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020097Run Menu (Editor window only):
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +000098
Andrew Svetlov1bd7f022013-01-14 19:27:36 +020099 Python Shell -- Open or wake up the Python shell window
100 ---
101 Check Module -- Check the syntax of the module currently open in the
102 Editor window. If the module has not been saved IDLE
103 will prompt the user to save the code.
104 Run Module -- Restart the shell to clean the environment, then
105 execute the currently open module. If the module has
106 not been saved IDLE will prompt the user to save the
107 code.
David Scherer7aced172000-08-15 01:13:23 +0000108
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200109Shell Menu (Shell window only):
Kurt B. Kaiser1061e722003-01-04 01:43:53 +0000110
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200111 View Last Restart -- Scroll the shell window to the last Shell restart
112 Restart Shell -- Restart the shell to clean the environment
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +0000113
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200114Debug Menu (Shell window only):
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +0000115
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200116 Go to File/Line -- Look around the insert point for a filename
117 and line number, open the file, and show the line.
118 Useful to view the source lines referenced in an
119 exception traceback. Available in the context
120 menu of the Shell window.
121 Debugger (toggle) -- This feature is not complete and considered
122 experimental. Run commands in the shell under the
123 debugger.
124 Stack Viewer -- Show the stack traceback of the last exception
125 Auto-open Stack Viewer (toggle) -- Toggle automatically opening the
126 stack viewer on unhandled
127 exception
Kurt B. Kaiser1061e722003-01-04 01:43:53 +0000128
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200129Options Menu (Shell and Editor):
David Scherer7aced172000-08-15 01:13:23 +0000130
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200131 Configure IDLE -- Open a configuration dialog. Fonts, indentation,
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +0000132 keybindings, and color themes may be altered.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200133 Startup Preferences may be set, and additional Help
Ned Deilyf1ce6de2015-07-04 15:05:07 -0700134 sources can be specified. On OS X, open the
135 configuration dialog by selecting Preferences
136 in the application menu.
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000137
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200138 ---
139 Code Context (toggle) -- Open a pane at the top of the edit window
140 which shows the block context of the section
141 of code which is scrolling off the top or the
142 window. This is not present in the Shell
143 window only the Editor window.
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000144
Ned Deilyccb416f2015-01-17 21:06:27 -0800145Window Menu (Shell and Editor):
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200146
147 Zoom Height -- Toggles the window between normal size (40x80 initial
148 setting) and maximum height. The initial size is in the Configure
149 IDLE dialog under the general tab.
150 ---
151 The rest of this menu lists the names of all open windows;
152 select one to bring it to the foreground (deiconifying it if
153 necessary).
David Scherer7aced172000-08-15 01:13:23 +0000154
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000155Help Menu:
156
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200157 About IDLE -- Version, copyright, license, credits
158 ---
159 IDLE Help -- Display this file which is a help file for IDLE
160 detailing the menu options, basic editing and navigation,
161 and other tips.
162 Python Docs -- Access local Python documentation, if
163 installed. Or will start a web browser and open
164 docs.python.org showing the latest Python documentation.
165 ---
166 Additional help sources may be added here with the Configure IDLE
167 dialog under the General tab.
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000168
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200169Editor context menu (Right-click / Control-click on OS X in Edit window):
Ned Deily2778d0d2012-10-20 13:25:34 -0700170
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200171 Cut -- Copy a selection into system-wide clipboard,
Andrew Svetlovd1837672012-11-01 22:41:19 +0200172 then delete the selection
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200173 Copy -- Copy selection into system-wide clipboard
174 Paste -- Insert system-wide clipboard into window
175 Set Breakpoint -- Sets a breakpoint. Breakpoints are only enabled
176 when the debugger is open.
177 Clear Breakpoint -- Clears the breakpoint on that line
Ned Deily2778d0d2012-10-20 13:25:34 -0700178
Andrew Svetlovd1837672012-11-01 22:41:19 +0200179Shell context menu (Right-click / Control-click on OS X in Shell window):
Ned Deily2778d0d2012-10-20 13:25:34 -0700180
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200181 Cut -- Copy a selection into system-wide clipboard,
Andrew Svetlovd1837672012-11-01 22:41:19 +0200182 then delete the selection
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200183 Copy -- Copy selection into system-wide clipboard
184 Paste -- Insert system-wide clipboard into window
185 ---
186 Go to file/line -- Same as in Debug menu
Ned Deily2778d0d2012-10-20 13:25:34 -0700187
Kurt B. Kaiser6fa09112003-01-14 22:06:11 +0000188
189** TIPS **
190==========
191
192Additional Help Sources:
193
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200194 Windows users can Google on zopeshelf.chm to access Zope help files in
195 the Windows help format. The Additional Help Sources feature of the
196 configuration GUI supports .chm, along with any other filetypes
197 supported by your browser. Supply a Menu Item title, and enter the
198 location in the Help File Path slot of the New Help Source dialog. Use
199 http:// and/or www. to identify external URLs, or download the file and
200 browse for its path on your machine using the Browse button.
Kurt B. Kaiser6fa09112003-01-14 22:06:11 +0000201
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200202 All users can access the extensive sources of help, including
203 tutorials, available at docs.python.org. Selected URLs can be added
204 or removed from the Help menu at any time using Configure IDLE.
David Scherer7aced172000-08-15 01:13:23 +0000205
206Basic editing and navigation:
207
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200208 Backspace deletes char to the left; DEL deletes char to the right.
209 Control-backspace deletes word left, Control-DEL deletes word right.
210 Arrow keys and Page Up/Down move around.
211 Control-left/right Arrow moves by words in a strange but useful way.
212 Home/End go to begin/end of line.
213 Control-Home/End go to begin/end of file.
214 Some useful Emacs bindings are inherited from Tcl/Tk:
215 Control-a beginning of line
216 Control-e end of line
217 Control-k kill line (but doesn't put it in clipboard)
218 Control-l center window around the insertion point
219 Standard keybindings (like Control-c to copy and Control-v to
220 paste) may work. Keybindings are selected in the Configure IDLE
221 dialog.
David Scherer7aced172000-08-15 01:13:23 +0000222
223Automatic indentation:
224
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200225 After a block-opening statement, the next line is indented by 4 spaces
226 (in the Python Shell window by one tab). After certain keywords
227 (break, return etc.) the next line is dedented. In leading
228 indentation, Backspace deletes up to 4 spaces if they are there. Tab
229 inserts spaces (in the Python Shell window one tab), number depends on
230 Indent Width. Currently tabs are restricted to four spaces due
231 to Tcl/Tk limitations.
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +0000232
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000233 See also the indent/dedent region commands in the edit menu.
David Scherer7aced172000-08-15 01:13:23 +0000234
Thomas Wouterscf297e42007-02-23 15:07:44 +0000235Completions:
236
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200237 Completions are supplied for functions, classes, and attributes of
238 classes, both built-in and user-defined. Completions are also provided
239 for filenames.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000240
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200241 The AutoCompleteWindow (ACW) will open after a predefined delay
242 (default is two seconds) after a '.' or (in a string) an os.sep is
243 typed. If after one of those characters (plus zero or more other
244 characters) a tab is typed the ACW will open immediately if a possible
245 continuation is found.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000246
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200247 If there is only one possible completion for the characters entered, a
248 tab will supply that completion without opening the ACW.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000249
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200250 'Show Completions' will force open a completions window, by default the
251 Control-space keys will open a completions window. In an empty
252 string, this will contain the files in the current directory. On a
253 blank line, it will contain the built-in and user-defined functions and
254 classes in the current name spaces, plus any modules imported. If some
255 characters have been entered, the ACW will attempt to be more specific.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000256
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200257 If string of characters is typed, the ACW selection will jump to the
258 entry most closely matching those characters. Entering a tab will cause
259 the longest non-ambiguous match to be entered in the Edit window or
260 Shell. Two tabs in a row will supply the current ACW selection, as
261 will return or a double click. Cursor keys, Page Up/Down, mouse
262 selection, and the scroll wheel all operate on the ACW.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000263
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200264 "Hidden" attributes can be accessed by typing the beginning of hidden
265 name after a '.', e.g. '_'. This allows access to modules with
266 '__all__' set, or to class-private attributes.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000267
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200268 Completions and the 'Expand Word' facility can save a lot of typing!
Thomas Wouterscf297e42007-02-23 15:07:44 +0000269
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200270 Completions are currently limited to those in the namespaces. Names in
271 an Editor window which are not via __main__ or sys.modules will not be
272 found. Run the module once with your imports to correct this
273 situation. Note that IDLE itself places quite a few modules in
274 sys.modules, so much can be found by default, e.g. the re module.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000275
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200276 If you don't like the ACW popping up unbidden, simply make the delay
277 longer or disable the extension. Or another option is the delay could
278 be set to zero. Another alternative to preventing ACW popups is to
279 disable the call tips extension.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000280
David Scherer7aced172000-08-15 01:13:23 +0000281Python Shell window:
282
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200283 Control-c interrupts executing command.
Roger Serwy22b9e652013-04-17 00:27:31 -0500284 Control-d sends end-of-file; closes window if typed at >>> prompt.
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200285 Alt-/ expand word is also useful to reduce typing.
David Scherer7aced172000-08-15 01:13:23 +0000286
287 Command history:
288
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200289 Alt-p retrieves previous command matching what you have typed. On OS X
290 use Control-p.
291 Alt-n retrieves next. On OS X use Control-n.
292 Return while cursor is on a previous command retrieves that command.
David Scherer7aced172000-08-15 01:13:23 +0000293
Kurt B. Kaisereb9637e2003-01-26 04:17:16 +0000294 Syntax colors:
David Scherer7aced172000-08-15 01:13:23 +0000295
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200296 The coloring is applied in a background "thread", so you may
297 occasionally see uncolorized text. To change the color
298 scheme, use the Configure IDLE / Highlighting dialog.
David Scherer7aced172000-08-15 01:13:23 +0000299
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000300 Python default syntax colors:
David Scherer7aced172000-08-15 01:13:23 +0000301
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200302 Keywords orange
303 Builtins royal purple
304 Strings green
305 Comments red
306 Definitions blue
David Scherer7aced172000-08-15 01:13:23 +0000307
Kurt B. Kaiser39c7b452002-12-11 04:42:39 +0000308 Shell default colors:
David Scherer7aced172000-08-15 01:13:23 +0000309
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200310 Console output brown
311 stdout blue
312 stderr red
313 stdin black
David Scherer7aced172000-08-15 01:13:23 +0000314
315Other preferences:
316
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200317 The font preferences, highlighting, keys, and general preferences can
318 be changed via the Configure IDLE menu option. Be sure to note that
319 keys can be user defined, IDLE ships with four built in key sets. In
320 addition a user can create a custom key set in the Configure IDLE
321 dialog under the keys tab.
David Scherer7aced172000-08-15 01:13:23 +0000322
323Command line usage:
Thomas Wouterscf297e42007-02-23 15:07:44 +0000324
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200325 Enter idle -h at the command prompt to get a usage message.
Kurt B. Kaiser8f570a72003-05-15 18:52:51 +0000326
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200327 idle.py [-c command] [-d] [-e] [-s] [-t title] [arg] ...
Kurt B. Kaiser8f570a72003-05-15 18:52:51 +0000328
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200329 -c command run this command
330 -d enable debugger
331 -e edit mode; arguments are files to be edited
332 -s run $IDLESTARTUP or $PYTHONSTARTUP first
333 -t title set title of shell window
334
335 If there are arguments:
336 1. If -e is used, arguments are files opened for editing and sys.argv
337 reflects the arguments passed to IDLE itself.
338 2. Otherwise, if -c is used, all arguments are placed in
339 sys.argv[1:...], with sys.argv[0] set to -c.
340 3. Otherwise, if neither -e nor -c is used, the first argument is a
341 script which is executed with the remaining arguments in
342 sys.argv[1:...] and sys.argv[0] set to the script name. If the
343 script name is -, no script is executed but an interactive Python
344 session is started; the arguments are still available in sys.argv.
345
R David Murraya707f292013-04-13 15:29:22 -0400346Running without a subprocess: (DEPRECATED in Python 3.4 see Issue 16123)
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200347
348 If IDLE is started with the -n command line switch it will run in a
349 single process and will not create the subprocess which runs the RPC
350 Python execution server. This can be useful if Python cannot create
351 the subprocess or the RPC socket interface on your platform. However,
352 in this mode user code is not isolated from IDLE itself. Also, the
353 environment is not restarted when Run/Run Module (F5) is selected. If
354 your code has been modified, you must reload() the affected modules and
355 re-import any specific items (e.g. from foo import baz) if the changes
356 are to take effect. For these reasons, it is preferable to run IDLE
357 with the default subprocess if at all possible.
Thomas Wouterscf297e42007-02-23 15:07:44 +0000358
359Extensions:
360
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200361 IDLE contains an extension facility. See the beginning of
362 config-extensions.def in the idlelib directory for further information.
363 The default extensions are currently:
Thomas Wouterscf297e42007-02-23 15:07:44 +0000364
Andrew Svetlov1bd7f022013-01-14 19:27:36 +0200365 FormatParagraph
366 AutoExpand
367 ZoomHeight
368 ScriptBinding
369 CallTips
370 ParenMatch
371 AutoComplete
372 CodeContext