python3.7的IDEL怎么清屏
生活随笔
收集整理的這篇文章主要介紹了
python3.7的IDEL怎么清屏
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.找到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)2.講ClearWindow.py復制到Python安裝路徑下:Python37\Lib\idlelib
3.在相同的路徑下,找到config-extensions.def文件
4.打開config-extensions.def文件,在文件末尾加入以下代碼:
[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>
保存文件,并關閉
5.退出IDEL,重新打開,在option下面就有了Clear shell window ctrl+;選項
6.在IDLE輸入代碼,然后按Ctrl+;(是指Ctrl和;),發現剛輸入代碼可以被清除了。
總結
以上是生活随笔為你收集整理的python3.7的IDEL怎么清屏的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 图示离散函数周期
- 下一篇: (附源码)python 在线办公系统 毕