1, http://bugs.python.org/issue6143 download list of the second clearwindow.py (2009-6-15 version), right-click Save As can.
You can copy the following to create a new clearwindow.py
1 """2 3 Clear Window Extension4 version:0.25 6 author:roger D. Serwy7 [email protected]8 9 date:2009-06-14Ten One It provides "Clear Shell window" under "Options" A With ability to undo. - - ADD These lines to Config-extensions.def the - [ClearWindow] - enable=1 - enable_editor=0 + enable_shell=1 - [Clearwindow_cfgbindings] + clear-window=<control-key-l> A at - """ - - classClearWindow: - -Menudefs = [ in('Options', [None, -('Clear Shell Window','<<clear-window>>'), to ]),] + - def __init__(self, editwin): theSelf.editwin =Editwin *Self.text =Self.editwin.text $Self.text.bind ("<<clear-window>>", Self.clear_window2)Panax Notoginseng -Self.text.bind ("<<undo>>", self.undo_event)#add= "+" doesn ' t work the + defundo_event (Self, event): AText =Self.text the +Text.mark_set ("IOMARK2","Iomark") -Text.mark_set ("Insert2","Insert") $ self.editwin.undo.undo_event (Event) $ - #fix Iomark and insert -Text.mark_set ("Iomark","IOMARK2") theText.mark_set ("Insert","Insert2") -Text.mark_unset ("IOMARK2")WuyiText.mark_unset ("Insert2") the - Wu defClear_window2 (self, event):#Alternative Method - #Work around the Modifiedundodelegator AboutText =Self.text $ Text.undo_block_start () -Text.mark_set ("IOMARK2","Iomark") -Text.mark_set ("Iomark", 1.0) -Text.delete (1.0,"IOMARK2 Linestart") AText.mark_set ("Iomark","IOMARK2") +Text.mark_unset ("IOMARK2") the text.undo_block_stop () - ifSelf.text.compare ('Insert','<','Iomark'): $Self.text.mark_set ('Insert','end-1c') the Self.editwin.set_line_and_column () the the defClear_window (Self, event): the #Remove undo Delegator -Undo =Self.editwin.undo in self.editwin.per.removefilter (undo) the the #clear the window, but preserve current command AboutSelf.text.delete (1.0,"Iomark Linestart") the ifSelf.text.compare ('Insert','<','Iomark'): theSelf.text.mark_set ('Insert','end-1c') the Self.editwin.set_line_and_column () + - #Restore undo Delegator the self.editwin.per.insertfilter (undo)Bayi
2. Place the file under the Python installation path: Python36\lib\idlelib (mine is C:\Python34\Lib\idlelib)
3. Under the same path, locate the Config-extensions.def file
4. Open with Notepad and stick the following code at the end:
[ClearWindow]
Enable=1
Enable_editor=0
Enable_shell=1
[Clearwindow_cfgbindings]
Clear-window=<control-key-l>
5, save, close the file. Restart idle, with the Clear shell window option under option. Shortcut keys are CTRL + L
Python3.6.3 IDLE clearwindow Clear Screen extension