Is there a way to clear the \"Run\" console in PyCharm? I want a code that delete/hide all the print() made previously. Like the \"clear_all\" button, but without having to
In Pycharm:
CMD + ,
(or Pycharm preferences);CTRL + L
or anything)Easy Method: Shortcut: Control K, Right click on terminal and clear Buffer
You could just do a ("\n" * 100000000), so it'll be impossible to scroll back.
Just click the trash can icon to the left of the command window and it clears the command history!
In PyCharm terminal you can type 'cls' just like in linux terminal.
For Python Console (where you see the output) assign a shortkey for "clear all" in File -> Settings -> Keymap -> Other -> "Clear all"
You can also click somewhere on the PythonConsole -> Right button -> clear.
Hope it helps
I just relised that instead of going to the trouble of setting up a shortcut, you could just set up a command using PyAutoGUI to click on the trash bin on the side of the window e.g
note, to install pyautogui click on the end of the import pyautogui
line, then press alt+enter and click install pyautogui.
import pyautogui
# to find the coordinates of the bin...
from time import sleep
sleep(2) # hover your mouse over bin in this time
mousepos = pyautogui.position() gets current pos of mouse
print(mousepos) # prints current pos of mouse
# then to clear it;
pyautogui.click(x, y) # and just put this line of code wherever you want to clear it
(this isn't perfect thanks to the time it takes to run the code and using the mouse, but it is reasonable solution depending on what you are using it for.) I hope this answer is helpful even though this is an old question.