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