日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python的idel下添加清屏功能

發布時間:2023/12/14 python 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python的idel下添加清屏功能 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
  • 第一步:下載文件ClearWindow.py (該文件可以在文章末尾網盤下載)
  • 第二步:找到目錄 E:\python\Lib\idlelib (這個目錄為python安裝路徑,比如我的安裝路徑為e:\python)
  • 第三步:將下載好的ClearWindow.py文件放到這個目錄(E:\python\Lib\idlelib)下
  • 第四步:在該目錄(E:\python\Lib\idlelib)下找到文件 config-extensions.def,用記事本打開,并在末尾添加:
  • ? ? ? ? ? ? ? ? ? ?[ClearWindow]
    ? ? ? ? ? ? ? ? ? ?enable=1
    ? ? ? ? ? ? ? ? ? ?enable_editor=0
    ? ? ? ? ? ? ? ? ? ?enable_shell=1
    ? ? ? ? ? ? ? ? ? ?[ClearWindow_cfgBindings]
    ? ? ? ? ? ? ? ? ? ?clear-window=<Control-Key-l>

    注:如果不想用Ctrl + L這個組合鍵清屏,可以根據自己的需要改變最后一行的代碼,如:想要改為Ctrl + W ,可將 clear-window=<Control-Key-l>改為 clear-window=<Control-Key-w> 即可。

    ? ? ? ? ?如:

    ? ? ? ? ?5.第五步:保存退出即可。然后打開python idel可以在Options選項下看到多了一行 clear shell window? Ctrl + L.那么表示添加成功。點擊此選項或者按組合鍵Ctrl + L即可達到清屏的作用。如圖:

    ?

    連接:https://pan.baidu.com/s/15lpDxTosytW3228tNY48Xw? ? ? ?提取碼:795n

    注:如果不能下載,將下面的代碼復制到文檔中,另存為ClearWindow.py即可。

    """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)

    ?

    總結

    以上是生活随笔為你收集整理的python的idel下添加清屏功能的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。