【PE/Python】python IDLE添加行号显示

本文介绍了如何为Python的IDLE集成开发环境添加行号显示功能。首先需要下载LineNumber.py扩展文件,并将其放置在Python安装目录的idlelib文件夹中。接着编辑config-extensions.def文件,启用LineNumbers配置,保存后重启IDLE即可实现行号显示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

   
    转载自:http://blog.youkuaiyun.com/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 (\t) 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即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值