Welcome to Python! A great language for program development.
Answers might be platform-dependent (are you using WIndows, Linux, etc.).
However, the following works for me on WIndows. You can put it in the
startup.py file so you don't have to type it every time you start up the
IDLE.
import os
def cls(): x=os.system("cls")
Now whenever you type
cls()
it will clear the screen and show the prompt at the top of the screen.
(The reason for the "x=" is: os.system returns a result, in this case
0. When you evaluate an expression in the IDE, the IDE prints the
result. So without the "x=" you get an extra line at the top of the
screen containing "0".)
I am sure that some jiggery-pokery could be used so you don't have to
type the "()". But that's more advanced ...
Best wishes
Rob Cliffe
On 04/06/2024 14:34, Cave Man via Python-list wrote:
Hello everyone,
I am new to Python, and I have been using IDLE (v3.10.11) to run
small Python code. However, I have seen that the output scrolls to the
bottom in the output window.
Is there a way to clear the output window (something like cls in
command prompt or clear in terminal), so that output stays at the top?
Thanks in anticipation!
--
https://mail.python.org/mailman/listinfo/python-list