Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 1 | .. _idle: |
| 2 | |
Ned Deily | 50afcc0 | 2015-02-06 15:42:06 +1100 | [diff] [blame] | 3 | IDLE |
| 4 | ==== |
| 5 | |
Terry Jan Reedy | fa089b9 | 2016-06-11 15:02:54 -0400 | [diff] [blame] | 6 | .. moduleauthor:: Guido van Rossum <guido@python.org> |
| 7 | |
| 8 | **Source code:** :source:`Lib/idlelib/` |
| 9 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 10 | .. index:: |
Christian Heimes | 5b5e81c | 2007-12-31 16:14:33 +0000 | [diff] [blame] | 11 | single: IDLE |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 12 | single: Python Editor |
| 13 | single: Integrated Development Environment |
| 14 | |
Terry Jan Reedy | fa089b9 | 2016-06-11 15:02:54 -0400 | [diff] [blame] | 15 | -------------- |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 16 | |
Terry Jan Reedy | d470527 | 2015-10-02 23:22:59 -0400 | [diff] [blame] | 17 | IDLE is Python's Integrated Development and Learning Environment. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 18 | |
| 19 | IDLE has the following features: |
| 20 | |
Georg Brandl | ac6060c | 2008-05-17 18:44:45 +0000 | [diff] [blame] | 21 | * coded in 100% pure Python, using the :mod:`tkinter` GUI toolkit |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 22 | |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 23 | * cross-platform: works mostly the same on Windows, Unix, and Mac OS X |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 24 | |
Terry Jan Reedy | 6e10ec5 | 2015-09-23 20:00:33 -0400 | [diff] [blame] | 25 | * Python shell window (interactive interpreter) with colorizing |
| 26 | of code input, output, and error messages |
| 27 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 28 | * multi-window text editor with multiple undo, Python colorizing, |
Terry Jan Reedy | 6e10ec5 | 2015-09-23 20:00:33 -0400 | [diff] [blame] | 29 | smart indent, call tips, auto completion, and other features |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 30 | |
Terry Jan Reedy | 6e10ec5 | 2015-09-23 20:00:33 -0400 | [diff] [blame] | 31 | * search within any window, replace within editor windows, and search |
| 32 | through multiple files (grep) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 33 | |
Terry Jan Reedy | 6e10ec5 | 2015-09-23 20:00:33 -0400 | [diff] [blame] | 34 | * debugger with persistent breakpoints, stepping, and viewing |
| 35 | of global and local namespaces |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 36 | |
Terry Jan Reedy | 6e10ec5 | 2015-09-23 20:00:33 -0400 | [diff] [blame] | 37 | * configuration, browsers, and other dialogs |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 38 | |
| 39 | Menus |
| 40 | ----- |
| 41 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 42 | IDLE has two main window types, the Shell window and the Editor window. It is |
| 43 | possible to have multiple editor windows simultaneously. Output windows, such |
| 44 | as used for Edit / Find in Files, are a subtype of edit window. They currently |
| 45 | have the same top menu as Editor windows but a different default title and |
| 46 | context menu. |
| 47 | |
| 48 | IDLE's menus dynamically change based on which window is currently selected. |
| 49 | Each menu documented below indicates which window type it is associated with. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 50 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 51 | File menu (Shell and Editor) |
| 52 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 53 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 54 | New File |
| 55 | Create a new file editing window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 56 | |
| 57 | Open... |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 58 | Open an existing file with an Open dialog. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 59 | |
| 60 | Recent Files |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 61 | Open a list of recent files. Click one to open it. |
| 62 | |
| 63 | Open Module... |
| 64 | Open an existing module (searches sys.path). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 65 | |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 66 | .. index:: |
| 67 | single: Class browser |
| 68 | single: Path browser |
| 69 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 70 | Class Browser |
| 71 | Show functions, classes, and methods in the current Editor file in a |
| 72 | tree structure. In the shell, open a module first. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 73 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 74 | Path Browser |
| 75 | Show sys.path directories, modules, functions, classes and methods in a |
| 76 | tree structure. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 77 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 78 | Save |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 79 | Save the current window to the associated file, if there is one. Windows |
| 80 | that have been changed since being opened or last saved have a \* before |
| 81 | and after the window title. If there is no associated file, |
| 82 | do Save As instead. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 83 | |
| 84 | Save As... |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 85 | Save the current window with a Save As dialog. The file saved becomes the |
| 86 | new associated file for the window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 87 | |
| 88 | Save Copy As... |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 89 | Save the current window to different file without changing the associated |
| 90 | file. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 91 | |
| 92 | Print Window |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 93 | Print the current window to the default printer. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 94 | |
| 95 | Close |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 96 | Close the current window (ask to save if unsaved). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 97 | |
| 98 | Exit |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 99 | Close all windows and quit IDLE (ask to save unsaved windows). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 100 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 101 | Edit menu (Shell and Editor) |
| 102 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 103 | |
| 104 | Undo |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 105 | Undo the last change to the current window. A maximum of 1000 changes may |
| 106 | be undone. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 107 | |
| 108 | Redo |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 109 | Redo the last undone change to the current window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 110 | |
| 111 | Cut |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 112 | Copy selection into the system-wide clipboard; then delete the selection. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 113 | |
| 114 | Copy |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 115 | Copy selection into the system-wide clipboard. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 116 | |
| 117 | Paste |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 118 | Insert contents of the system-wide clipboard into the current window. |
| 119 | |
| 120 | The clipboard functions are also available in context menus. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 121 | |
| 122 | Select All |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 123 | Select the entire contents of the current window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 124 | |
| 125 | Find... |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 126 | Open a search dialog with many options |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 127 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 128 | Find Again |
| 129 | Repeat the last search, if there is one. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 130 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 131 | Find Selection |
| 132 | Search for the currently selected string, if there is one. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 133 | |
| 134 | Find in Files... |
Serhiy Storchaka | 6a7b3a7 | 2016-04-17 08:32:47 +0300 | [diff] [blame] | 135 | Open a file search dialog. Put results in a new output window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 136 | |
| 137 | Replace... |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 138 | Open a search-and-replace dialog. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 139 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 140 | Go to Line |
| 141 | Move cursor to the line number requested and make that line visible. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 142 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 143 | Show Completions |
| 144 | Open a scrollable list allowing selection of keywords and attributes. See |
| 145 | Completions in the Tips sections below. |
| 146 | |
| 147 | Expand Word |
| 148 | Expand a prefix you have typed to match a full word in the same window; |
| 149 | repeat to get a different expansion. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 150 | |
| 151 | Show call tip |
| 152 | After an unclosed parenthesis for a function, open a small window with |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 153 | function parameter hints. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 154 | |
| 155 | Show surrounding parens |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 156 | Highlight the surrounding parenthesis. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 157 | |
| 158 | Format menu (Editor window only) |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 159 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 160 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 161 | Indent Region |
| 162 | Shift selected lines right by the indent width (default 4 spaces). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 163 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 164 | Dedent Region |
| 165 | Shift selected lines left by the indent width (default 4 spaces). |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 166 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 167 | Comment Out Region |
| 168 | Insert ## in front of selected lines. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 169 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 170 | Uncomment Region |
| 171 | Remove leading # or ## from selected lines. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 172 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 173 | Tabify Region |
| 174 | Turn *leading* stretches of spaces into tabs. (Note: We recommend using |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 175 | 4 space blocks to indent Python code.) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 176 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 177 | Untabify Region |
| 178 | Turn *all* tabs into the correct number of spaces. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 179 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 180 | Toggle Tabs |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 181 | Open a dialog to switch between indenting with spaces and tabs. |
| 182 | |
| 183 | New Indent Width |
| 184 | Open a dialog to change indent width. The accepted default by the Python |
| 185 | community is 4 spaces. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 186 | |
| 187 | Format Paragraph |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 188 | Reformat the current blank-line-delimited paragraph in comment block or |
| 189 | multiline string or selected line in a string. All lines in the |
| 190 | paragraph will be formatted to less than N columns, where N defaults to 72. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 191 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 192 | Strip trailing whitespace |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 193 | Remove any space characters after the last non-space character of a line. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 194 | |
| 195 | .. index:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 196 | single: Run script |
| 197 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 198 | Run menu (Editor window only) |
| 199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 200 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 201 | Python Shell |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 202 | Open or wake up the Python Shell window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 203 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 204 | Check Module |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 205 | Check the syntax of the module currently open in the Editor window. If the |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 206 | module has not been saved IDLE will either prompt the user to save or |
| 207 | autosave, as selected in the General tab of the Idle Settings dialog. If |
| 208 | there is a syntax error, the approximate location is indicated in the |
| 209 | Editor window. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 210 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 211 | Run Module |
| 212 | Do Check Module (above). If no error, restart the shell to clean the |
Terry Jan Reedy | 8b5a981 | 2015-09-24 01:39:30 -0400 | [diff] [blame] | 213 | environment, then execute the module. Output is displayed in the Shell |
| 214 | window. Note that output requires use of ``print`` or ``write``. |
| 215 | When execution is complete, the Shell retains focus and displays a prompt. |
| 216 | At this point, one may interactively explore the result of execution. |
| 217 | This is similar to executing a file with ``python -i file`` at a command |
| 218 | line. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 219 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 220 | Shell menu (Shell window only) |
| 221 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 222 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 223 | View Last Restart |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 224 | Scroll the shell window to the last Shell restart. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 225 | |
| 226 | Restart Shell |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 227 | Restart the shell to clean the environment. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 228 | |
Terry Jan Reedy | 4b73676 | 2016-09-12 01:50:03 -0400 | [diff] [blame] | 229 | Interrupt Execution |
| 230 | Stop a running program. |
| 231 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 232 | Debug menu (Shell window only) |
| 233 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 234 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 235 | Go to File/Line |
| 236 | Look on the current line. with the cursor, and the line above for a filename |
| 237 | and line number. If found, open the file if not already open, and show the |
| 238 | line. Use this to view source lines referenced in an exception traceback |
| 239 | and lines found by Find in Files. Also available in the context menu of |
| 240 | the Shell window and Output windows. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 241 | |
| 242 | .. index:: |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 243 | single: debugger |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 244 | single: stack viewer |
| 245 | |
| 246 | Debugger (toggle) |
| 247 | When actived, code entered in the Shell or run from an Editor will run |
| 248 | under the debugger. In the Editor, breakpoints can be set with the context |
| 249 | menu. This feature is still incomplete and somewhat experimental. |
| 250 | |
| 251 | Stack Viewer |
| 252 | Show the stack traceback of the last exception in a tree widget, with |
| 253 | access to locals and globals. |
| 254 | |
| 255 | Auto-open Stack Viewer |
| 256 | Toggle automatically opening the stack viewer on an unhandled exception. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 257 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 258 | Options menu (Shell and Editor) |
| 259 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 260 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 261 | Configure IDLE |
Terry Jan Reedy | 93f3542 | 2015-10-13 22:03:51 -0400 | [diff] [blame] | 262 | Open a configuration dialog and change preferences for the following: |
| 263 | fonts, indentation, keybindings, text color themes, startup windows and |
| 264 | size, additional help sources, and extensions (see below). On OS X, |
| 265 | open the configuration dialog by selecting Preferences in the application |
| 266 | menu. To use a new built-in color theme (IDLE Dark) with older IDLEs, |
| 267 | save it as a new custom theme. |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 268 | |
Terry Jan Reedy | 93f3542 | 2015-10-13 22:03:51 -0400 | [diff] [blame] | 269 | Non-default user settings are saved in a .idlerc directory in the user's |
| 270 | home directory. Problems caused by bad user configuration files are solved |
| 271 | by editing or deleting one or more of the files in .idlerc. |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 272 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 273 | Code Context (toggle)(Editor Window only) |
| 274 | Open a pane at the top of the edit window which shows the block context |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 275 | of the code which has scrolled above the top of the window. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 276 | |
Ned Deily | ccb416f | 2015-01-17 21:06:27 -0800 | [diff] [blame] | 277 | Window menu (Shell and Editor) |
| 278 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 279 | |
| 280 | Zoom Height |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 281 | Toggles the window between normal size and maximum height. The initial size |
| 282 | defaults to 40 lines by 80 chars unless changed on the General tab of the |
| 283 | Configure IDLE dialog. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 284 | |
| 285 | The rest of this menu lists the names of all open windows; select one to bring |
| 286 | it to the foreground (deiconifying it if necessary). |
| 287 | |
| 288 | Help menu (Shell and Editor) |
| 289 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 290 | |
| 291 | About IDLE |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 292 | Display version, copyright, license, credits, and more. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 293 | |
| 294 | IDLE Help |
| 295 | Display a help file for IDLE detailing the menu options, basic editing and |
| 296 | navigation, and other tips. |
| 297 | |
| 298 | Python Docs |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 299 | Access local Python documentation, if installed, or start a web browser |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 300 | and open docs.python.org showing the latest Python documentation. |
| 301 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 302 | Turtle Demo |
| 303 | Run the turtledemo module with example python code and turtle drawings. |
| 304 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 305 | Additional help sources may be added here with the Configure IDLE dialog under |
| 306 | the General tab. |
| 307 | |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 308 | .. index:: |
| 309 | single: Cut |
| 310 | single: Copy |
| 311 | single: Paste |
| 312 | single: Set Breakpoint |
| 313 | single: Clear Breakpoint |
| 314 | single: breakpoints |
| 315 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 316 | Context Menus |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 317 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 318 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 319 | Open a context menu by right-clicking in a window (Control-click on OS X). |
| 320 | Context menus have the standard clipboard functions also on the Edit menu. |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 321 | |
Andrew Svetlov | d183767 | 2012-11-01 22:41:19 +0200 | [diff] [blame] | 322 | Cut |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 323 | Copy selection into the system-wide clipboard; then delete the selection. |
Andrew Svetlov | d183767 | 2012-11-01 22:41:19 +0200 | [diff] [blame] | 324 | |
| 325 | Copy |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 326 | Copy selection into the system-wide clipboard. |
Andrew Svetlov | d183767 | 2012-11-01 22:41:19 +0200 | [diff] [blame] | 327 | |
| 328 | Paste |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 329 | Insert contents of the system-wide clipboard into the current window. |
| 330 | |
| 331 | Editor windows also have breakpoint functions. Lines with a breakpoint set are |
| 332 | specially marked. Breakpoints only have an effect when running under the |
| 333 | debugger. Breakpoints for a file are saved in the user's .idlerc directory. |
Andrew Svetlov | d183767 | 2012-11-01 22:41:19 +0200 | [diff] [blame] | 334 | |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 335 | Set Breakpoint |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 336 | Set a breakpoint on the current line. |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 337 | |
| 338 | Clear Breakpoint |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 339 | Clear the breakpoint on that line. |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 340 | |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 341 | Shell and Output windows have the following. |
Andrew Svetlov | d183767 | 2012-11-01 22:41:19 +0200 | [diff] [blame] | 342 | |
Ned Deily | 2778d0d | 2012-10-20 13:25:34 -0700 | [diff] [blame] | 343 | Go to file/line |
| 344 | Same as in Debug menu. |
| 345 | |
| 346 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 347 | Editing and navigation |
| 348 | ---------------------- |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 349 | |
Serhiy Storchaka | 0424eaf | 2015-09-12 17:45:25 +0300 | [diff] [blame] | 350 | In this section, 'C' refers to the :kbd:`Control` key on Windows and Unix and |
| 351 | the :kbd:`Command` key on Mac OSX. |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 352 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 353 | * :kbd:`Backspace` deletes to the left; :kbd:`Del` deletes to the right |
| 354 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 355 | * :kbd:`C-Backspace` delete word left; :kbd:`C-Del` delete word to the right |
| 356 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 357 | * Arrow keys and :kbd:`Page Up`/:kbd:`Page Down` to move around |
| 358 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 359 | * :kbd:`C-LeftArrow` and :kbd:`C-RightArrow` moves by words |
| 360 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 361 | * :kbd:`Home`/:kbd:`End` go to begin/end of line |
| 362 | |
| 363 | * :kbd:`C-Home`/:kbd:`C-End` go to begin/end of file |
| 364 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 365 | * Some useful Emacs bindings are inherited from Tcl/Tk: |
| 366 | |
| 367 | * :kbd:`C-a` beginning of line |
| 368 | |
| 369 | * :kbd:`C-e` end of line |
| 370 | |
| 371 | * :kbd:`C-k` kill line (but doesn't put it in clipboard) |
| 372 | |
| 373 | * :kbd:`C-l` center window around the insertion point |
| 374 | |
| 375 | * :kbd:`C-b` go backwards one character without deleting (usually you can |
| 376 | also use the cursor key for this) |
| 377 | |
| 378 | * :kbd:`C-f` go forward one character without deleting (usually you can |
| 379 | also use the cursor key for this) |
| 380 | |
| 381 | * :kbd:`C-p` go up one line (usually you can also use the cursor key for |
| 382 | this) |
| 383 | |
| 384 | * :kbd:`C-d` delete next character |
| 385 | |
| 386 | Standard keybindings (like :kbd:`C-c` to copy and :kbd:`C-v` to paste) |
| 387 | may work. Keybindings are selected in the Configure IDLE dialog. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 388 | |
| 389 | |
| 390 | Automatic indentation |
| 391 | ^^^^^^^^^^^^^^^^^^^^^ |
| 392 | |
| 393 | After a block-opening statement, the next line is indented by 4 spaces (in the |
| 394 | Python Shell window by one tab). After certain keywords (break, return etc.) |
| 395 | the next line is dedented. In leading indentation, :kbd:`Backspace` deletes up |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 396 | to 4 spaces if they are there. :kbd:`Tab` inserts spaces (in the Python |
| 397 | Shell window one tab), number depends on Indent width. Currently tabs |
| 398 | are restricted to four spaces due to Tcl/Tk limitations. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 399 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 400 | See also the indent/dedent region commands in the edit menu. |
| 401 | |
| 402 | Completions |
| 403 | ^^^^^^^^^^^ |
| 404 | |
| 405 | Completions are supplied for functions, classes, and attributes of classes, |
| 406 | both built-in and user-defined. Completions are also provided for |
| 407 | filenames. |
| 408 | |
| 409 | The AutoCompleteWindow (ACW) will open after a predefined delay (default is |
| 410 | two seconds) after a '.' or (in a string) an os.sep is typed. If after one |
| 411 | of those characters (plus zero or more other characters) a tab is typed |
| 412 | the ACW will open immediately if a possible continuation is found. |
| 413 | |
| 414 | If there is only one possible completion for the characters entered, a |
| 415 | :kbd:`Tab` will supply that completion without opening the ACW. |
| 416 | |
| 417 | 'Show Completions' will force open a completions window, by default the |
| 418 | :kbd:`C-space` will open a completions window. In an empty |
| 419 | string, this will contain the files in the current directory. On a |
| 420 | blank line, it will contain the built-in and user-defined functions and |
| 421 | classes in the current name spaces, plus any modules imported. If some |
| 422 | characters have been entered, the ACW will attempt to be more specific. |
| 423 | |
| 424 | If a string of characters is typed, the ACW selection will jump to the |
| 425 | entry most closely matching those characters. Entering a :kbd:`tab` will |
| 426 | cause the longest non-ambiguous match to be entered in the Editor window or |
| 427 | Shell. Two :kbd:`tab` in a row will supply the current ACW selection, as |
| 428 | will return or a double click. Cursor keys, Page Up/Down, mouse selection, |
| 429 | and the scroll wheel all operate on the ACW. |
| 430 | |
| 431 | "Hidden" attributes can be accessed by typing the beginning of hidden |
| 432 | name after a '.', e.g. '_'. This allows access to modules with |
| 433 | ``__all__`` set, or to class-private attributes. |
| 434 | |
| 435 | Completions and the 'Expand Word' facility can save a lot of typing! |
| 436 | |
| 437 | Completions are currently limited to those in the namespaces. Names in |
| 438 | an Editor window which are not via ``__main__`` and :data:`sys.modules` will |
| 439 | not be found. Run the module once with your imports to correct this situation. |
| 440 | Note that IDLE itself places quite a few modules in sys.modules, so |
| 441 | much can be found by default, e.g. the re module. |
| 442 | |
| 443 | If you don't like the ACW popping up unbidden, simply make the delay |
Terry Jan Reedy | 37f8135 | 2015-09-29 01:55:57 -0400 | [diff] [blame] | 444 | longer or disable the extension. |
| 445 | |
| 446 | Calltips |
| 447 | ^^^^^^^^ |
| 448 | |
Mariatta | 1b93ed4 | 2017-02-28 21:08:13 -0800 | [diff] [blame^] | 449 | A calltip is shown when one types :kbd:`(` after the name of an *accessible* |
Terry Jan Reedy | 37f8135 | 2015-09-29 01:55:57 -0400 | [diff] [blame] | 450 | function. A name expression may include dots and subscripts. A calltip |
| 451 | remains until it is clicked, the cursor is moved out of the argument area, |
| 452 | or :kbd:`)` is typed. When the cursor is in the argument part of a definition, |
| 453 | the menu or shortcut display a calltip. |
| 454 | |
| 455 | A calltip consists of the function signature and the first line of the |
| 456 | docstring. For builtins without an accessible signature, the calltip |
| 457 | consists of all lines up the fifth line or the first blank line. These |
| 458 | details may change. |
| 459 | |
| 460 | The set of *accessible* functions depends on what modules have been imported |
| 461 | into the user process, including those imported by Idle itself, |
| 462 | and what definitions have been run, all since the last restart. |
| 463 | |
| 464 | For example, restart the Shell and enter ``itertools.count(``. A calltip |
| 465 | appears because Idle imports itertools into the user process for its own use. |
| 466 | (This could change.) Enter ``turtle.write(`` and nothing appears. Idle does |
| 467 | not import turtle. The menu or shortcut do nothing either. Enter |
| 468 | ``import turtle`` and then ``turtle.write(`` will work. |
| 469 | |
| 470 | In an editor, import statements have no effect until one runs the file. One |
| 471 | might want to run a file after writing the import statements at the top, |
| 472 | or immediately run an existing file before editing. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 473 | |
| 474 | Python Shell window |
| 475 | ^^^^^^^^^^^^^^^^^^^ |
| 476 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 477 | * :kbd:`C-c` interrupts executing command |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 478 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 479 | * :kbd:`C-d` sends end-of-file; closes window if typed at a ``>>>`` prompt |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 480 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 481 | * :kbd:`Alt-/` (Expand word) is also useful to reduce typing |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 482 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 483 | Command history |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 484 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 485 | * :kbd:`Alt-p` retrieves previous command matching what you have typed. On |
| 486 | OS X use :kbd:`C-p`. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 487 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 488 | * :kbd:`Alt-n` retrieves next. On OS X use :kbd:`C-n`. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 489 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 490 | * :kbd:`Return` while on any previous command retrieves that command |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 491 | |
| 492 | |
Terry Jan Reedy | f660ce2 | 2015-09-24 23:13:49 -0400 | [diff] [blame] | 493 | Text colors |
| 494 | ^^^^^^^^^^^ |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 495 | |
Terry Jan Reedy | f660ce2 | 2015-09-24 23:13:49 -0400 | [diff] [blame] | 496 | Idle defaults to black on white text, but colors text with special meanings. |
| 497 | For the shell, these are shell output, shell error, user output, and |
| 498 | user error. For Python code, at the shell prompt or in an editor, these are |
| 499 | keywords, builtin class and function names, names following ``class`` and |
| 500 | ``def``, strings, and comments. For any text window, these are the cursor (when |
| 501 | present), found text (when possible), and selected text. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 502 | |
Terry Jan Reedy | f660ce2 | 2015-09-24 23:13:49 -0400 | [diff] [blame] | 503 | Text coloring is done in the background, so uncolorized text is occasionally |
| 504 | visible. To change the color scheme, use the Configure IDLE dialog |
| 505 | Highlighting tab. The marking of debugger breakpoint lines in the editor and |
| 506 | text in popups and dialogs is not user-configurable. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 507 | |
| 508 | |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 509 | Startup and code execution |
| 510 | -------------------------- |
Benjamin Peterson | f07d002 | 2009-03-21 17:31:58 +0000 | [diff] [blame] | 511 | |
| 512 | Upon startup with the ``-s`` option, IDLE will execute the file referenced by |
| 513 | the environment variables :envvar:`IDLESTARTUP` or :envvar:`PYTHONSTARTUP`. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 514 | IDLE first checks for ``IDLESTARTUP``; if ``IDLESTARTUP`` is present the file |
| 515 | referenced is run. If ``IDLESTARTUP`` is not present, IDLE checks for |
Benjamin Peterson | f07d002 | 2009-03-21 17:31:58 +0000 | [diff] [blame] | 516 | ``PYTHONSTARTUP``. Files referenced by these environment variables are |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 517 | convenient places to store functions that are used frequently from the IDLE |
Benjamin Peterson | f07d002 | 2009-03-21 17:31:58 +0000 | [diff] [blame] | 518 | shell, or for executing import statements to import common modules. |
| 519 | |
| 520 | In addition, ``Tk`` also loads a startup file if it is present. Note that the |
| 521 | Tk file is loaded unconditionally. This additional file is ``.Idle.py`` and is |
| 522 | looked for in the user's home directory. Statements in this file will be |
Terry Jan Reedy | 3ab745e | 2014-12-05 02:43:07 -0500 | [diff] [blame] | 523 | executed in the Tk namespace, so this file is not useful for importing |
| 524 | functions to be used from IDLE's Python shell. |
Benjamin Peterson | f07d002 | 2009-03-21 17:31:58 +0000 | [diff] [blame] | 525 | |
| 526 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 527 | Command line usage |
| 528 | ^^^^^^^^^^^^^^^^^^ |
| 529 | |
Martin Panter | 1050d2d | 2016-07-26 11:18:21 +0200 | [diff] [blame] | 530 | .. code-block:: none |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 531 | |
Terry Jan Reedy | 968e285 | 2015-09-23 03:52:23 -0400 | [diff] [blame] | 532 | idle.py [-c command] [-d] [-e] [-h] [-i] [-r file] [-s] [-t title] [-] [arg] ... |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 533 | |
Terry Jan Reedy | 968e285 | 2015-09-23 03:52:23 -0400 | [diff] [blame] | 534 | -c command run command in the shell window |
| 535 | -d enable debugger and open shell window |
| 536 | -e open editor window |
Terry Jan Reedy | 3399e1e | 2016-08-30 16:58:01 -0400 | [diff] [blame] | 537 | -h print help message with legal combinations and exit |
Terry Jan Reedy | 968e285 | 2015-09-23 03:52:23 -0400 | [diff] [blame] | 538 | -i open shell window |
| 539 | -r file run file in shell window |
| 540 | -s run $IDLESTARTUP or $PYTHONSTARTUP first, in shell window |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 541 | -t title set title of shell window |
Terry Jan Reedy | 968e285 | 2015-09-23 03:52:23 -0400 | [diff] [blame] | 542 | - run stdin in shell (- must be last option before args) |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 543 | |
| 544 | If there are arguments: |
| 545 | |
Terry Jan Reedy | 968e285 | 2015-09-23 03:52:23 -0400 | [diff] [blame] | 546 | * If ``-``, ``-c``, or ``r`` is used, all arguments are placed in |
| 547 | ``sys.argv[1:...]`` and ``sys.argv[0]`` is set to ``''``, ``'-c'``, |
| 548 | or ``'-r'``. No editor window is opened, even if that is the default |
| 549 | set in the Options dialog. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 550 | |
Terry Jan Reedy | 968e285 | 2015-09-23 03:52:23 -0400 | [diff] [blame] | 551 | * Otherwise, arguments are files opened for editing and |
| 552 | ``sys.argv`` reflects the arguments passed to IDLE itself. |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 553 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 554 | |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 555 | IDLE-console differences |
| 556 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 557 | |
| 558 | As much as possible, the result of executing Python code with IDLE is the |
| 559 | same as executing the same code in a console window. However, the different |
Terry Jan Reedy | 929d7f8 | 2016-05-02 18:30:02 -0400 | [diff] [blame] | 560 | interface and operation occasionally affects visible results. For instance, |
| 561 | ``sys.modules`` starts with more entries. |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 562 | |
Terry Jan Reedy | 929d7f8 | 2016-05-02 18:30:02 -0400 | [diff] [blame] | 563 | IDLE also replaces ``sys.stdin``, ``sys.stdout``, and ``sys.stderr`` with |
| 564 | objects that get input from and send output to the Shell window. |
| 565 | When this window has the focus, it controls the keyboard and screen. |
| 566 | This is normally transparent, but functions that directly access the keyboard |
| 567 | and screen will not work. If ``sys`` is reset with ``importlib.reload(sys)``, |
Terry Jan Reedy | 1f8cc33 | 2016-08-25 01:22:30 -0400 | [diff] [blame] | 568 | IDLE's changes are lost and things like ``input``, ``raw_input``, and |
Terry Jan Reedy | 929d7f8 | 2016-05-02 18:30:02 -0400 | [diff] [blame] | 569 | ``print`` will not work correctly. |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 570 | |
| 571 | With IDLE's Shell, one enters, edits, and recalls complete statements. |
Terry Jan Reedy | 1f8cc33 | 2016-08-25 01:22:30 -0400 | [diff] [blame] | 572 | Some consoles only work with a single physical line at a time. IDLE uses |
| 573 | ``exec`` to run each statement. As a result, ``'__builtins__'`` is always |
| 574 | defined for each statement. |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 575 | |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 576 | Running without a subprocess |
| 577 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 578 | |
Terry Jan Reedy | 0053c47 | 2015-09-24 03:09:43 -0400 | [diff] [blame] | 579 | By default, IDLE executes user code in a separate subprocess via a socket, |
Terry Jan Reedy | 6e10ec5 | 2015-09-23 20:00:33 -0400 | [diff] [blame] | 580 | which uses the internal loopback interface. This connection is not |
| 581 | externally visible and no data is sent to or received from the Internet. |
| 582 | If firewall software complains anyway, you can ignore it. |
| 583 | |
| 584 | If the attempt to make the socket connection fails, Idle will notify you. |
| 585 | Such failures are sometimes transient, but if persistent, the problem |
| 586 | may be either a firewall blocking the connecton or misconfiguration of |
| 587 | a particular system. Until the problem is fixed, one can run Idle with |
| 588 | the -n command line switch. |
| 589 | |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 590 | If IDLE is started with the -n command line switch it will run in a |
| 591 | single process and will not create the subprocess which runs the RPC |
| 592 | Python execution server. This can be useful if Python cannot create |
| 593 | the subprocess or the RPC socket interface on your platform. However, |
| 594 | in this mode user code is not isolated from IDLE itself. Also, the |
| 595 | environment is not restarted when Run/Run Module (F5) is selected. If |
| 596 | your code has been modified, you must reload() the affected modules and |
| 597 | re-import any specific items (e.g. from foo import baz) if the changes |
| 598 | are to take effect. For these reasons, it is preferable to run IDLE |
| 599 | with the default subprocess if at all possible. |
| 600 | |
| 601 | .. deprecated:: 3.4 |
| 602 | |
Georg Brandl | 116aa62 | 2007-08-15 14:28:22 +0000 | [diff] [blame] | 603 | |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 604 | Help and preferences |
| 605 | -------------------- |
| 606 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 607 | Additional help sources |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 608 | ^^^^^^^^^^^^^^^^^^^^^^^ |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 609 | |
| 610 | IDLE includes a help menu entry called "Python Docs" that will open the |
| 611 | extensive sources of help, including tutorials, available at docs.python.org. |
| 612 | Selected URLs can be added or removed from the help menu at any time using the |
| 613 | Configure IDLE dialog. See the IDLE help option in the help menu of IDLE for |
| 614 | more information. |
| 615 | |
| 616 | |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 617 | Setting preferences |
| 618 | ^^^^^^^^^^^^^^^^^^^ |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 619 | |
| 620 | The font preferences, highlighting, keys, and general preferences can be |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 621 | changed via Configure IDLE on the Option menu. Keys can be user defined; |
| 622 | IDLE ships with four built in key sets. In addition a user can create a |
| 623 | custom key set in the Configure IDLE dialog under the keys tab. |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 624 | |
Terry Jan Reedy | f568494 | 2014-12-04 00:54:59 -0500 | [diff] [blame] | 625 | |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 626 | Extensions |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 627 | ^^^^^^^^^^ |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 628 | |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 629 | IDLE contains an extension facility. Peferences for extensions can be |
| 630 | changed with Configure Extensions. See the beginning of config-extensions.def |
| 631 | in the idlelib directory for further information. The default extensions |
| 632 | are currently: |
Andrew Svetlov | 1bd7f02 | 2013-01-14 19:27:36 +0200 | [diff] [blame] | 633 | |
| 634 | * FormatParagraph |
| 635 | |
| 636 | * AutoExpand |
| 637 | |
| 638 | * ZoomHeight |
| 639 | |
| 640 | * ScriptBinding |
| 641 | |
| 642 | * CallTips |
| 643 | |
| 644 | * ParenMatch |
| 645 | |
| 646 | * AutoComplete |
| 647 | |
| 648 | * CodeContext |
| 649 | |
Terry Jan Reedy | bb37b4c | 2014-12-04 01:26:04 -0500 | [diff] [blame] | 650 | * RstripExtension |