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