1README.txt: an index to idlelib files and the IDLE menu.
2
3IDLE is Python's Integrated Development and Learning
4Environment.  The user documentation is part of the Library Reference and
5is available in IDLE by selecting Help => IDLE Help.  This README documents
6idlelib for IDLE developers and curious users.
7
8IDLELIB FILES lists files alphabetically by category,
9with a short description of each.
10
11IDLE MENU show the menu tree, annotated with the module
12or module object that implements the corresponding function.
13
14This file is descriptive, not prescriptive, and may have errors
15and omissions and lag behind changes in idlelib.
16
17
18IDLELIB FILES
19=============
20
21Implementation files not in IDLE MENU are marked (nim).
22
23Startup
24-------
25__init__.py  # import, does nothing
26__main__.py  # -m, starts IDLE
27idle.bat
28idle.py
29idle.pyw
30
31Implementation
32--------------
33autocomplete.py   # Complete attribute names or filenames.
34autocomplete_w.py # Display completions.
35autoexpand.py     # Expand word with previous word in file.
36browser.py        # Create module browser window.
37calltip.py        # Create calltip text.
38calltip_w.py      # Display calltip.
39codecontext.py    # Show compound statement headers otherwise not visible.
40colorizer.py      # Colorize text (nim).
41config.py         # Load, fetch, and save configuration (nim).
42configdialog.py   # Display user configuration dialogs.
43config_key.py     # Change keybindings.
44debugger.py       # Debug code run from shell or editor; show window.
45debugger_r.py     # Debug code run in remote process.
46debugobj.py       # Define class used in stackviewer.
47debugobj_r.py     # Communicate objects between processes with rpc (nim).
48delegator.py      # Define base class for delegators (nim).
49dynoption.py      # Define mutable OptionMenu widget (nim)
50editor.py         # Define most of editor and utility functions.
51filelist.py       # Open files and manage list of open windows (nim).
52format.py         # Define format menu options.
53grep.py           # Find all occurrences of pattern in multiple files.
54help.py           # Display IDLE's html doc.
55help_about.py     # Display About IDLE dialog.
56history.py        # Get previous or next user input in shell (nim)
57hyperparser.py    # Parse code around a given index.
58iomenu.py         # Open, read, and write files
59macosx.py         # Help IDLE run on Macs (nim).
60mainmenu.py       # Define most of IDLE menu.
61multicall.py      # Wrap tk widget to allow multiple calls per event (nim).
62outwin.py         # Create window for grep output.
63parenmatch.py     # Match fenceposts: (), [], and {}.
64pathbrowser.py    # Create path browser window.
65percolator.py     # Manage delegator stack (nim).
66pyparse.py        # Give information on code indentation
67pyshell.py        # Start IDLE, manage shell, complete editor window
68query.py          # Query user for information
69redirector.py     # Intercept widget subcommands (for percolator) (nim).
70replace.py        # Search and replace pattern in text.
71rpc.py            # Communicate between idle and user processes (nim).
72run.py            # Manage user code execution subprocess.
73runscript.py      # Check and run user code.
74scrolledlist.py   # Define scrolledlist widget for IDLE (nim).
75search.py         # Search for pattern in text.
76searchbase.py     # Define base for search, replace, and grep dialogs.
77searchengine.py   # Define engine for all 3 search dialogs.
78sidebar.py        # Define line number and shell prompt sidebars.
79squeezer.py       # Squeeze long shell output (nim).
80stackviewer.py    # View stack after exception.
81statusbar.py      # Define status bar for windows (nim).
82tabbedpages.py    # Define tabbed pages widget (nim).
83textview.py       # Define read-only text widget (nim).
84tooltip.py        # Define popups for calltips, squeezer (nim).
85tree.py           # Define tree widget, used in browsers (nim).
86undo.py           # Manage undo stack.
87util.py           # Define common objects imported elsewhere (nim).
88windows.py        # Manage window list and define listed top level.
89zoomheight.py     # Zoom window to full height of screen.
90zzdummy.py        # Example extension.
91
92Configuration
93-------------
94config-extensions.def # Defaults for extensions
95config-highlight.def  # Defaults for colorizing
96config-keys.def       # Defaults for key bindings
97config-main.def       # Defaults for font and general tabs
98
99Text
100----
101CREDITS.txt  # not maintained, displayed by About IDLE
102HISTORY.txt  # NEWS up to July 2001
103NEWS.txt     # commits, displayed by About IDLE
104NEWS2.txt    # commits to Python2
105README.txt   # this file, displayed by About IDLE
106TODO.txt     # needs review
107extend.txt   # about writing extensions
108help.html    # copy of idle.html in docs, displayed by IDLE Help
109
110Subdirectories
111--------------
112Icons        # small image files
113idle_test    # files for human test and automated unit tests
114
115
116IDLE MENUS
117==========
118
119Top level items and most submenu items are defined in mainmenu.
120Extensions add submenu items when active.  The names given are
121found, quoted, in one of these modules, paired with a '<<pseudoevent>>'.
122Each pseudoevent is bound to an event handler.  Some event handlers
123call another function that does the actual work.  The annotations below
124are intended to at least give the module where the actual work is done.
125'eEW' = editor.EditorWindow
126
127File
128  New File         # eEW.new_callback
129  Open...          # iomenu.open
130  Open Module      # eEw.open_module
131  Recent Files
132  Class Browser    # eEW.open_class_browser, browser.ClassBrowser
133  Path Browser     # eEW.open_path_browser, pathbrowser
134  ---
135  Save             # iomenu.save
136  Save As...       # iomenu.save_as
137  Save Copy As...  # iomenu.save_a_copy
138  ---
139  Print Window     # iomenu.print_window
140  ---
141  Close            # eEW.close_event
142  Exit             # flist.close_all_callback (bound in eEW)
143
144Edit
145  Undo             # undodelegator
146  Redo             # undodelegator
147  ---              # eEW.right_menu_event
148  Cut              # eEW.cut
149  Copy             # eEW.copy
150  Paste            # eEW.past
151  Select All       # eEW.select_all (+ see eEW.remove_selection)
152  ---              # Next 5 items use searchengine; dialogs use searchbase
153  Find             # eEW.find_event, search.SearchDialog.find
154  Find Again       # eEW.find_again_event, sSD.find_again
155  Find Selection   # eEW.find_selection_event, sSD.find_selection
156  Find in Files... # eEW.find_in_files_event, grep
157  Replace...       # eEW.replace_event, replace.ReplaceDialog.replace
158  Go to Line       # eEW.goto_line_event
159  Show Completions # autocomplete extension and autocompleteWidow (&HP)
160  Expand Word      # autoexpand extension
161  Show call tip    # Calltips extension and CalltipWindow (& Hyperparser)
162  Show surrounding parens  # parenmatch (& Hyperparser)
163
164Format (Editor only) [fFR = format.FormatRegion]
165  Format Paragraph # format.FormatParagraph.format_paragraph_event
166  Indent Region    # fFR.indent_region_event
167  Dedent Region    # fFR.dedent_region_event
168  Comment Out Reg. # fFR.comment_region_event
169  Uncomment Region # fFR.uncomment_region_event
170  Tabify Region    # fFR.tabify_region_event
171  Untabify Region  # fFR.untabify_region_event
172  Toggle Tabs      # format.Indents.toggle_tabs_event
173  New Indent Width # format.Indents.change_indentwidth_event
174  Strip tailing whitespace  # format.rstrip
175  Zin              # zzdummy
176  Zout             # zzdummy
177
178Run (Editor only)
179  Run Module         # runscript.ScriptBinding.run_module_event
180  Run... Customized  # runscript.ScriptBinding.run_custom_event
181  Check Module       # runscript.ScriptBinding.check_module_event
182  Python Shell       # pyshell.Pyshell, pyshell.ModifiedInterpreter
183
184Shell  # pyshell
185  View Last Restart    # pyshell.PyShell.view_restart_mark
186  Restart Shell        # pyshell.PyShell.restart_shell
187  Previous History     # history.History.history_prev
188  Next History         # history.History.history_next
189  Interrupt Execution  # pyshell.PyShell.cancel_callback
190
191Debug (Shell only)
192  Go to File/Line  # outwin.OutputWindow.goto_file_line
193  debugger         # debugger, debugger_r, PyShell.toggle_debugger
194  Stack Viewer     # stackviewer, PyShell.open_stack_viewer
195  Auto-open Stack Viewer  # stackviewer
196
197Options
198  Configure IDLE   # eEW.config_dialog, config, configdialog (cd)
199    (Parts of the dialog)
200    Buttons        # cd.ConfigDialog
201    Font tab       # cd.FontPage, config-main.def
202    Highlight tab  # cd.HighPage, query, config-highlight.def
203    Keys tab       # cd.KeysPage, query, config_key, config_keys.def
204    Windows tab    # cd.WinPage, config_main.def
205    Shell/Ed tab   # cd.ShedPage, config-main.def
206    Extensions tab # config-extensions.def, corresponding .py files
207  ---
208  ... Code Context # codecontext
209  ... Line Numbers # sidebar
210  Zoomheight       # zoomheight
211
212Window
213  <open windows>   # windows
214
215Help
216  About IDLE       # eEW.about_dialog, help_about.AboutDialog
217  ---
218  IDLE Help        # eEW.help_dialog, help.show_idlehelp
219  Python Docs      # eEW.python_docs
220  Turtle Demo      # eEW.open_turtle_demo
221  ---
222  <other help sources>
223
224<Context Menu> (right click)
225  Defined in editor, PyShell.pyshell
226    Cut
227    Copy
228    Paste
229    ---
230    Go to file/line (shell and output only)
231    Set Breakpoint (editor only)
232    Clear Breakpoint (editor only)
233  Defined in debugger
234    Go to source line
235    Show stack frame
236
237<No menu>
238Center Insert      # eEW.center_insert_event
239
240
241OTHER TOPICS
242============
243
244Generally use PEP 8.
245
246import statements
247-----------------
248Put imports at the top, unless there is a good reason otherwise.
249PEP 8 says to group stdlib, 3rd-party dependencies, and package imports.
250For idlelib, the groups are general stdlib, tkinter, and idlelib.
251Sort modules within each group, except that tkinter.ttk follows tkinter.
252Sort 'from idlelib import mod1' and 'from idlelib.mod2 import object'
253together by module, ignoring within module objects.
254Put 'import __main__' after other idlelib imports.
255
256Imports only needed for testing are put not at the top but in an
257htest function def or "if __name__ == '__main__'" clause.
258
259Within module imports like "from idlelib.mod import class" may cause
260circular imports to deadlock.  Even without this, circular imports may
261require at least one of the imports to be delayed until a function call.
262
263What's New entries
264------------------
265
266Repository directory Doc/whatsnew/ has a file 3.n.rst for each 3.n
267Python version.  For the first entry in each file, add subsection
268'IDLE and idlelib', in alphabetical position, to the 'Improved Modules'
269section.  For the rest of cpython, entries to 3.(n+1).rst begin with
270the release of 3.n.0b1.  For IDLE, entries for features backported from
271'main' to '3.n' during its beta period do not got in 3.(n+1).rst.  The
272latter usually gets its first entry during the 3.n.0 candidate period
273or after the 3.n.0 release.
274
275When, as per PEP 434, feature changes are backported, entries are placed
276in the 3.n.rst file *in the main branch* for each Python version n that
277gets the backport. (Note: the format of entries have varied between
278versions.)  Add a line "New in 3.n maintenance releases." before the
279first back-ported feature after 3.n.0 is released. Since each older
280version file gets a different number of backports, it is easiest to
281make a separate PR for each file and label it with the backports
282needed.
283
284Github repository and issues
285----------------------------
286
287The CPython repository is https://github.com/python/cpython.  The
288IDLE Issues listing is https://github.com/orgs/python/projects/31.
289The main classification is by Topic, based on the IDLE menu.  View the
290topics list by clicking the [<]] button in the upper right.
291