新建ClearWindows.py,复制以下代码:

class ClearWindow:

    menudefs = [
('options', [None,
('Clear Shell Window', '<<clear-window>>'),
]),] def __init__(self, editwin):
self.editwin = editwin
self.text = self.editwin.text
self.text.bind("<<clear-window>>", self.clear_window2) self.text.bind("<<undo>>", self.undo_event) # add="+" doesn't work def undo_event(self, event):
text = self.text text.mark_set("iomark2", "iomark")
text.mark_set("insert2", "insert")
self.editwin.undo.undo_event(event) # fix iomark and insert
text.mark_set("iomark", "iomark2")
text.mark_set("insert", "insert2")
text.mark_unset("iomark2")
text.mark_unset("insert2") def clear_window2(self, event): # Alternative method
# work around the ModifiedUndoDelegator
text = self.text
text.undo_block_start()
text.mark_set("iomark2", "iomark")
text.mark_set("iomark", 1.0)
text.delete(1.0, "iomark2 linestart")
text.mark_set("iomark", "iomark2")
text.mark_unset("iomark2")
text.undo_block_stop()
if self.text.compare('insert', '<', 'iomark'):
self.text.mark_set('insert', 'end-1c')
self.editwin.set_line_and_column() def clear_window(self, event):
# remove undo delegator
undo = self.editwin.undo
self.editwin.per.removefilter(undo) # clear the window, but preserve current command
self.text.delete(1.0, "iomark linestart")
if self.text.compare('insert', '<', 'iomark'):
self.text.mark_set('insert', 'end-1c')
self.editwin.set_line_and_column() # restore undo delegator
self.editwin.per.insertfilter(undo)

将文件放在安装目录的...\Lib\idlelib目录下,然后在相同路径找到config-extensions.def文件,在文件末尾添加以下代码:

[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>

IDLE清屏扩展的更多相关文章

  1. python3.4学习笔记(三) idle 清屏扩展插件

    python3.4学习笔记(三) idle 清屏扩展插件python idle 清屏问题的解决,使用python idle都会遇到一个常见而又懊恼的问题——要怎么清屏?在stackoverflow看到 ...

  2. 转:python idle 清屏问题的解决

    http://www.cnblogs.com/maybego/p/3234055.html python idle 清屏问题的解决 在学习和使用python的过程中,少不了要与python idle打 ...

  3. Python:IDLE清屏

    清屏很简单,为IDLE增加一个清屏的扩展ClearWindow即可. 首先下载clearwindow.py(点击可直接下载,不能下载的可以右键保存,格式为py结尾), 将这个文件放到Python安装目 ...

  4. python idle 清屏问题的解决

    在学习和使用python的过程中,少不了要与python idle打交道.但使用python idle都会遇到一个常见而又懊恼的问题——要怎么清屏?   我在stackoverflow看到这样两种答案 ...

  5. Python IDLE清屏

    在学习和使用Python的过程中,少不了要与Python IDLE打交道.但使用 Python IDLE 都会遇到一个常见而又懊恼的问题--要怎么清屏? 答案是为IDLE增加一个清屏的扩展ClearW ...

  6. Python IDLE 清屏工具

     转载自:http://www.cnblogs.com/maybego/p/3234055.html   1.下载clearwindow.py(右击-目标另存为,直接点击会打开脚本内容). 2.拷贝c ...

  7. 【Python】IDLE清屏

    上网搜,没搜到可用的快捷键.但看到一个通过打印空内容来清屏的方法,smart ef clear(): for i in range(60): print

  8. IDLE的GUI交互模式下完美清屏

    IDLE的GUI交互模式下完美清屏==============================================================================1.首先把 ...

  9. Python IDLE配置清屏快捷键(Ctrl+L)

    1.在Python\Lib\idlelib下,新建一个ClearWindow.py文件(没有时就新建),内容如下: """ Clear Window Extension ...

随机推荐

  1. Median

    #include <stdio.h> #include <stdlib.h> #include <math.h> #define MAXSIZE 1000 int ...

  2. 【Solution】API测试工具,访问方式

    1. post的时候,@requestBody 用 json的传递方式

  3. c# 中HttpClient访问Https网站

    c# 中HttpClient访问Https网站,加入如下代码: handler = new HttpClientHandler() ;handler.AllowAutoRedirect = true; ...

  4. CentOS 7 安装samba服务

    STEP 1. 安装 #安装 [root@study ~]yum install smaba [root@study ~]systemctl start smb nmb STEP 2. 建立共享目录以 ...

  5. spoj 1029 Matrix Summation

    题意: 对一个矩阵有2种操作: 1.把某个元素设为x. 2.查询以(x1,y1)为左上角 以(x2,y2)为右上角的矩阵中的数字的和. 思路: 二维树状数组入门题,同时对横坐标和纵坐标做前缀和就行了. ...

  6. 移动App专项测试

    移动App测试实战—专项测试 转自:http://www.51testing.com/html/58/n-3713758.html 我们在进行了手工的功能测试之后,也开发了一些自动化测试用例,并且做了 ...

  7. datatable的select()结果直接修改,会体现在表上

    如果你只是要修改DataTable里的DataRow的话没有必要找到它的行号,直接在Select后得到的DataRow上修改就行了,它的修改会直接反映到DataTable上(其实就是直接修改了Data ...

  8. python的对象 变量

    对象 所有的数据类型都是对象 字符串 数字:整数.数字 列表.字典 函数.类.模块.方法 print(type(20)) # 查看对象的数据类型 python整型: int  浮点型 :float 精 ...

  9. [转]SQL中 OVER(PARTITION BY) 取上一条,下一条等

    OVER(PARTITION BY)函数介绍 开窗函数               Oracle从8.1.6开始提供分析函数,分析函数用于计算基于组的某种聚合值,它和聚合函数的不同之处是:对于每个组返 ...

  10. 关于IIS的4月26日笔记

    常用命令: 31. regedit.exe----注册表 48. msconfig.exe---系统配置实用程序  80. services.msc---本地服务设置 93. regedit.exe- ...