On 08/06/2024 14.18, Rob Cliffe wrote:
OK, here is the advanced version:
import os
class _cls(object):
def __repr__(self):
os.system('cls')
return ''
cls = _cls()
Now when you type
cls
it clears the screen. The only flaw is that there is a blank line at the very top of th
On 10/06/2024 09.32, Stefan Ram wrote:
"Michael F. Stemper" wrote or quoted:
On 08/06/2024 14.18, Rob Cliffe wrote:
OK, here is the advanced version:
import os
class _cls(object):
def __repr__(self):
os.system('cls')
return ''
cls = _cls()
...
Why have it return any
On 08/06/2024 20:18, Rob Cliffe via Python-list wrote:
> OK, here is the advanced version:
> import os
> class _cls(object):
> def __repr__(self):
> os.system('cls')
> return ''
> cls = _cls()
>
> Now when you type
> cls
> it clears the screen.
For me on a Mac it clears t
OK, here is the advanced version:
import os
class _cls(object):
def __repr__(self):
os.system('cls')
return ''
cls = _cls()
Now when you type
cls
it clears the screen. The only flaw is that there is a blank line at
the very top of the screen, and the ">>>" prompt appears on
On 05/06/2024 04:09, Cameron Simpson wrote:
On 04Jun2024 22:43, Rob Cliffe wrote:
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
On 04Jun2024 22:43, Rob Cliffe wrote:
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
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
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