cls

Jeff Epler jepler at unpythonic.net
Sun Feb 29 02:51:52 CET 2004


This change makes printing the formfeed character, '\f', clear the shell
window in idle.  I don't know if it also has other undesirable
consequences (I'm not an idle user, and I don't have the patience to do
much testing).  Given this, 
    def cls():
        print '\f'


Index: Lib/idlelib//OutputWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/OutputWindow.py,v
retrieving revision 1.10
diff -u -r1.10 OutputWindow.py
--- Lib/idlelib//OutputWindow.py	9 Jul 2003 18:48:24 -0000	1.10
+++ Lib/idlelib//OutputWindow.py	29 Feb 2004 01:30:34 -0000
@@ -35,6 +35,13 @@
     # Act as output file
 
     def write(self, s, tags=(), mark="insert"):
+        if "\x0c" in s:
+            print "OutputWindow.write saw ^L"
+            self.text.mark_unset("iomark")
+            s = s.split("\x0c")[-1]
+            print "new s: ", s
+            self.text.delete(0.0, "end")
+            self.text.mark_set("iomark", 0.0)
         # Tk assumes that byte strings are Latin-1;
         # we assume that they are in the locale's encoding
         if isinstance(s, str):




More information about the Python-list mailing list