1

After hours of exercises I want to clear the screen to remove the debris above. I am using IDLE as the shell. Any hope?

Research Research Research.

I can find none that work on the iMac.

martineau
  • 119,623
  • 25
  • 170
  • 301
  • Possible duplicate of [Any way to clear python's IDLE window?](https://stackoverflow.com/questions/1432480/any-way-to-clear-pythons-idle-window) – HFBrowning Jan 08 '19 at 00:01

3 Answers3

0

Are you on linux? It's the only os that can clear IDLE, as far as I'm aware:

import os
os.system('clear')

Of course, there's always the goofy option:

print("\n") * 100
Daniel Scott
  • 979
  • 7
  • 16
0

AFAIK, there is no built in functionality for this in idle. You can sort of “clear” it by printing a bunch of new lines though.

print(‘\n’*80)
JPeroutek
  • 558
  • 1
  • 7
  • 20
0

The following works now on any system, not just Mac: open an editor window if there is not one already (new, untitled, is OK), close Shell, in the editor, click Run => Python Shell or Run Module (F5).

Adding something more direct has been discussed for a decade, but with no agreement on the various technical issues. I am thinking now of adding a "Clear and Restart" item to the Shell menu that would irreversibly clear Shell's window, keep the statement history, and restart the execution process (which is what 'Restart Shell' does).

Terry Jan Reedy
  • 18,414
  • 3
  • 40
  • 52