zoukankan      html  css  js  c++  java
  • python的IDEL编辑器清屏文件配置

    1.找到PythonPythonXLibidlelib(x为你的版本号),在当前目录下添加ClearWindow.py,复制提供的代码,保存为*.py即可。

     1 class ClearWindow:
     2 
     3     menudefs = [
     4         ('options', [None,
     5                ('Clear Shell Window', '<<clear-window>>'),
     6        ]),]
     7 
     8     def __init__(self, editwin):
     9         self.editwin = editwin
    10         self.text = self.editwin.text
    11         self.text.bind("<<clear-window>>", self.clear_window2)
    12 
    13         self.text.bind("<<undo>>", self.undo_event)  # add="+" doesn't work
    14 
    15     def undo_event(self, event):
    16         text = self.text
    17         
    18         text.mark_set("iomark2", "iomark")
    19         text.mark_set("insert2", "insert")
    20         self.editwin.undo.undo_event(event)
    21 
    22         # fix iomark and insert
    23         text.mark_set("iomark", "iomark2")
    24         text.mark_set("insert", "insert2")
    25         text.mark_unset("iomark2")
    26         text.mark_unset("insert2")
    27         
    28 
    29     def clear_window2(self, event): # Alternative method
    30         # work around the ModifiedUndoDelegator
    31         text = self.text
    32         text.undo_block_start()
    33         text.mark_set("iomark2", "iomark")
    34         text.mark_set("iomark", 1.0)
    35         text.delete(1.0, "iomark2 linestart")
    36         text.mark_set("iomark", "iomark2")
    37         text.mark_unset("iomark2")
    38         text.undo_block_stop()
    39         if self.text.compare('insert', '<', 'iomark'):
    40             self.text.mark_set('insert', 'end-1c')
    41         self.editwin.set_line_and_column()
    42 
    43     def clear_window(self, event):
    44         # remove undo delegator
    45         undo = self.editwin.undo
    46         self.editwin.per.removefilter(undo)
    47 
    48         # clear the window, but preserve current command
    49         self.text.delete(1.0, "iomark linestart")
    50         if self.text.compare('insert', '<', 'iomark'):
    51             self.text.mark_set('insert', 'end-1c')
    52         self.editwin.set_line_and_column()
    53 
    54         # restore undo delegator
    55         self.editwin.per.insertfilter(undo)
    ClearWindow.py

    2.在当前目录下找到config-extensions.def 并修改,在末尾添加如下代码:

    [ClearWindow]
    enable=True
    enable_editor=False
    enable_shell=True
    [ClearWindow_cfgBindings]
    clear-window=<Control-Key-l>
    配置内容

    3. 重新打开IDEL即可,如果快捷键无效的话,注意查看ClearWindow.py的大小写以及配置文件内容的大小写状态

  • 相关阅读:
    写壳笔记一(加节表)
    cs_forums_GetForumsModeratedByUser///cs_forums_GetUnmoderatedPostStatus
    cs_Favorites_Get///cs_Favorites_GetSections
    cs_Feed_UpdateFeedStatus///cs_FeedPost_GetPost///cs_FeedPost_GetPostFullDetails///cs_FeedPost_UpdatePosts
    又来牢骚一下
    cs_Favorite_Delete///cs_Favorite_Get
    cs_Folder_GetFolders///cs_Folder_GetSummary///cs_Folder_MoveFolder
    cs_Folder_RenameFolder///cs_forums_GetForumMessages///cs_forums_GetForumModerators
    cs_Favorites_GetUsers///cs_Favorites_GetUsersWatching
    cs_Feed_AddFeed///cs_Feed_GetAll
  • 原文地址:https://www.cnblogs.com/chaiquan/p/10294420.html
Copyright © 2011-2022 走看看