python IDEL 清屏
在Option 中增加clear shell window选项
1)将下述文件保存为ClearWindow.py,
并放置在 C:\\Users\\LIN\\AppData\\Local\\Programs\\Python\\Python37\\Lib\\idlelib'下
查看路径的方法,import sys, print(sys.path)
"""Clear Window Extension Version: 0.2Author: Roger D. Serwyroger.serwy@gmail.comDate: 2009-06-14It provides "Clear Shell Window" under "Options" with ability to undo.Add these lines to config-extensions.def[ClearWindow] enable=1 enable_editor=0 enable_shell=1 [ClearWindow_cfgBindings] clear-window=<Control-Key-l>"""class ClearWindow:menudefs = [('options', [None,('Clear Shell Window', '<<clear-window>>'),]),]def __init__(self, editwin):self.editwin = editwinself.text = self.editwin.textself.text.bind("<<clear-window>>", self.clear_window2)self.text.bind("<<undo>>", self.undo_event) # add="+" doesn't workdef undo_event(self, event):text = self.texttext.mark_set("iomark2", "iomark")text.mark_set("insert2", "insert")self.editwin.undo.undo_event(event)# fix iomark and inserttext.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 ModifiedUndoDelegatortext = self.texttext.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 delegatorundo = self.editwin.undoself.editwin.per.removefilter(undo)# clear the window, but preserve current commandself.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 delegatorself.editwin.per.insertfilter(undo)
2) 打开config-extensions.def 后在句末加上这样几句:
[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>
然后保存退出就可以了。
打开python的idle,看看options是不是多了一个选项clear shell window ctrl+L
python IDEL 清屏相关推荐
- 转:Python Shell 清屏方法
原文地址: https://blog.csdn.net/howard2005/article/details/79879289 Python Shell 清屏方法 2018年04月10日 12:14: ...
- python怎么清屏_python怎么清屏
广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 我试图用python编写一个程序,但是我不知道如何清除屏幕. 我同时使用wind ...
- python idle 清屏问题的解决
在学习和使用python的过程中,少不了要与python idle打交道.但使用python idle都会遇到一个常见而又懊恼的问题--要怎么清屏? 我在stackoverflow看到这样两种答案 ...
- python控制台清屏_Python Shell 怎样清屏?
启动Python有两种方式,分别为"Windows命令行窗口"和"IDLE" "命令行窗口"下可以通过如下两种方法: 1. import s ...
- python怎么清屏_python实现清屏的方法 Python Shell中清屏一般有两种方法。
Python Shell 怎样清屏? Python Shell中清屏一般有两种方法. 奈何一个人随着年龄增长,梦想便不复轻盈:他开始用双手掂量生活,更看重果实而非花朵.--叶芝<凯尔特的搏暮&g ...
- python idle清屏_python idle怎么清屏
在学习和使用python 写代码时(据说高手都用IDLE写代码的),少不了要与Python IDLE打交道.但使用 Python IDLE 都会遇到一个常见而又懊恼的问题:不能清屏? 下载clearw ...
- python控制台清屏代码_python中代码清屏的方法是什么
python中代码清屏的方法是什么 发布时间:2020-09-03 10:52:03 来源:亿速云 阅读:97 作者:小新 这篇文章给大家分享的是有关python中代码清屏的方法是什么的内容.小编觉得 ...
- Mac中实现python IDLE清屏
python IDLE中是不带清屏功能的,所以为了实现清屏功能,特地查阅了一些资料,现整理记录一下. 第一步:准备好所需的清屏代码: """Clear Window Ex ...
- python怎么清屏_python中怎么清屏
一."Windows命令行窗口"下清屏,可用下面两种方法: 第一种方法,在命令行窗口输入:import os i=os.system("cls") 第二种方法, ...
最新文章
- 欢迎大家批评:CSDN Blog用户体验调查
- 关于Uncaught SyntaxError: Unexpected identifier
- Vue中使用vue-video-player和videojs-flash插件实现播放rtmp视频文件流
- Eclipse workplace local storage
- Hibernate工作原理(1)
- 3级调度 fpga_Vivado HLS学习笔记——1.了解FPGA架构
- Java数学工具类MathUtil
- c语言 怎么把数据存储,急求如何将下列C语言程序数据存储到文件中?
- Dynamics CRM 2015Online Update1 new feature之 通过业务规则清空字段的值
- 风云2号卫星云图_中国为什么要发这么多卫星?答案没有出乎意料
- java set retainall_Java的Set集合中的retainAll()方法
- 常见操作系统体系结构
- C 中使用GDI+制作个性化的网站新闻标题
- 如何下载知乎或好看视频
- 愚见《Nighttime Visibility Enhancement by Increasing the Dynamic Range andSuppression of Light Effects》
- 阿里云视频点播服务SDK的使用,视频文件上传测试
- 西门子1200PLC的MODBUS_RTU轮询程序
- 前端开发审查元素时CSS样式有个横线(该CSS样式定义后无效) 的解决办法
- SpringBoot+Vue项目校园二手交易平台
- 宝峰对讲机16频率表_宝峰uv5r系列对讲机出厂预置频率表-手工编辑版
热门文章
- 97-ICMP 协议(端口不可达)
- python map函数的作用_Python map()函数介绍及用法
- linux脚本创建快捷方式,批处理BAT创建快捷方式
- 深度剖析淘宝天猫搜索逻辑
- Vue eslint 报错 eval can be harmful解决办法
- conda错误this environment is insistent,please check the package plan carefully
- scrapy mysql数据库_Python3学习系列(十三):Scrapy将数据存入Mysql数据库
- 《软件测试---你必须掌握的100个问题》
- bzoj 3036: 绿豆蛙的归宿
- Lua系列--pairs和ipairs