Any way to clear pythons IDLE window?

Any way to clear pythons IDLE window?

The cls and clear are commands which will clear a terminal (ie a DOS prompt, or terminal window). From your screenshot, you are using the shell within IDLE, which wont be affected by such things. Unfortunately, I dont think there is a way to clear the screen in IDLE. The best you could do is to scroll the screen down lots of lines, eg:

print (n * 100)

Though you could put this in a function:

def cls(): print (n * 100)

And then call it when needed as cls()

os.system(clear) works on linux. If you are running windows try os.system(CLS) instead.

You need to import os first like this:

import os

Any way to clear pythons IDLE window?

Most of the answers, here do clearing the DOS prompt screen, with clearing commands, which is not the question. Other answers here, were printing blank lines to show a clearing effect of the screen.

The simplest answer of this question is

It is not possible to clear python IDLE shell without some external module integration. If you really want to get a blank pure fresh shell just close the previous shell and run it again

Leave a Reply

Your email address will not be published. Required fields are marked *