加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

idle清屏

发布时间:2020-12-15 23:15:50 所属栏目:安全 来源:网络整理
导读:步骤: 下载一个叫ClearWindow.py 的扩展文件,代码如下(将以下代码命名为ClearWindow.py,注意大小写) class ClearWindow: ? ? menudefs = [ ? ? ? ( ‘options‘,[ None, ? ? ? ? ? ? ? ( ‘Clear Shell Window‘, ‘clear-window‘), ? ? ? ]),] ? ? de

步骤:

  • 下载一个叫ClearWindow.py 的扩展文件,代码如下(将以下代码命名为ClearWindow.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_window)
    ? ?def clear_window2(self,event): # Alternative method
    ? ? ? ?# work around the ModifiedUndoDelegator
    ? ? ? ?text = self.text
    ? ? ? ?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")
    ? ? ? ?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‘,‘end-1c‘)
    ? ? ? ?self.editwin.set_line_and_column()

    ? ? ? ?# restore undo delegator
    ? ? ? ?self.editwin.per.insertfilter(undo)
    ?
  • 打开python的安装目录(默认在C:UsersAdministratorAppDataLocalProgramsPythonPython36-32Libidlelib,如果实在是找不到安装的地方,在开始菜单中打开idle,选择交互模式,输入代码 ? ? ? import os ? print(os.getcwd()),输出的即为python的安装目录),找到lib目录下的idlelib 目录,然后把上面的代码拷贝到idlelib目录下。找到config-extensions.def 配置文件打开,在文件末尾加入以下配置即完成idle清屏插件的安装,清屏快捷键 Ctrl + L

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读