转载自:http://blog.csdn.net/listener51/article/details/79052155
1、下载LineNumber.py
http://idlex.sourceforge.net/extensions.html
https://sourceforge.net/projects/idlex/?source=typ_redirect
IDleX----IDLE Extensions for Python
Features
- Terminal-like behavior for Shell. Cursor stays in prompt and up/down arrow keys cycle the command history.
- Persistent history of Shell commands across sessions.
- Paste and run multiple lines in the shell.
- Non-blocking interactive GUI development for Tkinter, GTK, Qt, Qt4, PySide, wxPython
- Matplotlib support for interactive figures when using the subprocess.
- Clear Shell Window without restarting Shell.
- Capture large output and display it as an expandable button.
- Tabbed editor windows with drag'n'drop reordering.
- Improved code navigation with Code Browser.
- Line numbers for the editor.
- Find and Replace as a toolbar with incremental searching.
- Intelligent Paste from Shell. (remove >>> prompts)
- Highlight tabs ( ) in editor to help fix tab/space issues.
- Integrated reindent.py support.
- Horizontal scroll bar for the editor.
- Export contents with syntax highlighting as HTML.
- Cython editing and execution support.
- Execute highlighted code or a single line from the editor with F9.
- SubCodes, similar to MATLAB cell mode and IPython/Sagemath cells, for quick code prototyping without restarting the shell.
- Run parts of a script separated by "##" markers in the editor with Ctrl+Return.
- Stop a running script with Ctrl+C from the Editor.
- Documentation Viewer to view help() and doc strings in a separate window.
- Simple interface for enabling/disabling extensions.
- Right-click context menu with Cut, Copy, and Paste.
2、配置方法
(1)先下载LineNumber.py文件。然后将文件放在python安装目录下的idlelib目录下
(2)然后再用文本编辑器打开idlelib目录下的config-extensions.def文件。将如下配置参数写入文件:
[LineNumbers]
enable=1
enable_editor=1
enable_shell=0
visible=1
再保存此文件,重新打开idle即可。