1

All I wanted to ask that if i want to clear screen in IDLE what method I can use to clear it without closing it. For e.g. I print this statement using:-

print("Prabal Tiwari")

after getting output of this I want to clear the console without closing it. Just like we use "clear" on ubuntu terminal.

Prabal Tiwari
  • 35
  • 1
  • 1
  • 8

2 Answers2

1

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 won't be affected by such things. Unfortunately, I don't 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()

source: Any way to clear python's IDLE window?

Community
  • 1
  • 1
Robert I
  • 1,509
  • 2
  • 11
  • 18
  • I've been trying to put this into a function and have it called on start-up but have been running around in circles in trying to get the function called with the environmental variable (Mac OSX). Any help? https://stackoverflow.com/questions/49677593/how-do-i-import-my-user-defined-function-without-having-to-call-the-py-file-it – jimmytt Apr 08 '18 at 00:17
0

I think you can restart it but I don't think there is any way to do it without restarting the console. Hope this helped!

jgeraghty7
  • 19
  • 4