python的idel下添加清屏功能
? ? ? ? ? ? ? ? ? ?[ClearWindow]
? ? ? ? ? ? ? ? ? ?enable=1
? ? ? ? ? ? ? ? ? ?enable_editor=0
? ? ? ? ? ? ? ? ? ?enable_shell=1
? ? ? ? ? ? ? ? ? ?[ClearWindow_cfgBindings]
? ? ? ? ? ? ? ? ? ?clear-window=<Control-Key-l>
注:如果不想用Ctrl + L這個(gè)組合鍵清屏,可以根據(jù)自己的需要改變最后一行的代碼,如:想要改為Ctrl + W ,可將 clear-window=<Control-Key-l>改為 clear-window=<Control-Key-w> 即可。
? ? ? ? ?如:
? ? ? ? ?5.第五步:保存退出即可。然后打開python idel可以在Options選項(xiàng)下看到多了一行 clear shell window? Ctrl + L.那么表示添加成功。點(diǎn)擊此選項(xiàng)或者按組合鍵Ctrl + L即可達(dá)到清屏的作用。如圖:
?
連接:https://pan.baidu.com/s/15lpDxTosytW3228tNY48Xw? ? ? ?提取碼:795n
注:如果不能下載,將下面的代碼復(fù)制到文檔中,另存為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)?
總結(jié)
以上是生活随笔為你收集整理的python的idel下添加清屏功能的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java 生产mdb_Java生成mdb
- 下一篇: mysql 查询分析器_MYSQL查询分