Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Someone whom you reject today, will reject you tomorrow.


comp / comp.lang.python / Fwd: IDLE: clearing the screen

SubjectAuthor
o Fwd: IDLE: clearing the screenRob Cliffe

1
Subject: Fwd: IDLE: clearing the screen
From: Rob Cliffe
Newsgroups: comp.lang.python
Date: Tue, 4 Jun 2024 21:43 UTC
References: 1 2
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: rob.cliffe@btinternet.com (Rob Cliffe)
Newsgroups: comp.lang.python
Subject: Fwd: IDLE: clearing the screen
Date: Tue, 4 Jun 2024 22:43:14 +0100
Lines: 39
Message-ID: <mailman.87.1717537403.2909.python-list@python.org>
References: <e5706680-aedd-4697-a413-abd23f43b579@btinternet.com>
<0b2a163c-6e83-4739-960d-35a038d4ff0b@btinternet.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de qgBdjUwsSFJ9iAKbplcCcwBl56H+J+jkMfWhVaGTGetg==
Cancel-Lock: sha1:IM9Rma5qVtg3Afv5lcxAOXPksdM= sha256:VZXP4MqZ1NJ0fZs5xPwaRqFudWNwtBwfFLwRXXmNO/o=
Return-Path: <rob.cliffe@btinternet.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=btinternet.com header.i=@btinternet.com header.b=YvQ0lM3k;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'everyone,': 0.03; 'def':
0.04; 'containing': 0.05; 'windows,': 0.05; 'linux,': 0.07;
'etc.).': 0.09; 'expression': 0.09; 'idle': 0.09; 'prints': 0.09;
'skip:x 10': 0.09; 'subject:IDLE': 0.09; 'window.': 0.09;
'import': 0.15; '(something': 0.16; 'ide,': 0.16; 'idle.': 0.16;
'subject:screen': 0.16; 'wrote:': 0.16; 'python': 0.16; 'code.':
0.17; 'to:addr:python-list': 0.20; 'language': 0.21; 'advanced':
0.22; 'returns': 0.22; 'command': 0.23; 'run': 0.23; 'python,':
0.25; 'subject:Fwd': 0.26; 'output': 0.28; 'header:User-Agent:1':
0.30; 'program': 0.31; 'answers': 0.32; 'python-list': 0.32;
'to:name:python': 0.32; 'window': 0.32; 'received:192.168.1':
0.32; 'but': 0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34;
'following': 0.35; 'using': 0.37; 'received:192.168': 0.37;
'file': 0.38; 'way': 0.38; 'could': 0.38; 'put': 0.38; 'thanks':
0.38; 'prompt': 0.39; 'ide': 0.40; 'received:213': 0.40;
'whenever': 0.40; 'wishes': 0.40; 'best': 0.61; 'seen': 0.62;
'great': 0.63; 'clear': 0.64; 'top': 0.65; 'result,': 0.69; 'man':
0.74; 'extra': 0.84; 'rob': 0.84; 'stays': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=btinternet.com;
s=btmx201904; t=1717537395;
bh=VGOKbo7aIg5zVvQ6QzyYwbHdt/iWTWSOGT+UwUmelZs=;
h=Message-ID:Date:MIME-Version:Subject:References:To:From:In-Reply-To;
b=YvQ0lM3kLl/I5/7AdwYAfkd0uk+0WJrPDoBwlVS8muLWt1Yz65mA8mBrjfWq9b5wf+grVOb21vZPoks+A46ztQRKR5EvpUayHbsLtHeUACnHOmImoBSfW4QsAp6D+xRmOBCdtQ/MMqya+fdEGAZVBohqO6hmCDAQpCElnJkvjYjKJAaCLQfH8waUKJEs9yoB4gQuDNpljOfbfSENFwC1Tb8LMrg+Xg2ApJohRoMAcsHvklqXxmtXjTu/1RlR61cxyRtfTtglMiIUqv2u97VpZ6ZQ0SLY8JT6GBvsdmNKKQEXUISfeKBNtWXCG89EpwwMgUZJSBzrgY4s8J6eyNK+TA==
Authentication-Results: btinternet.com;
auth=pass (PLAIN) smtp.auth=rob.cliffe@btinternet.com;
bimi=skipped
X-SNCR-Rigid: 6577B5E3141483D6
X-Originating-IP: [86.184.143.52]
X-OWM-Source-IP: 86.184.143.52
X-OWM-Env-Sender: rob.cliffe@btinternet.com
X-VadeSecure-score: verdict=clean score=0/300, class=clean
X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgedvledrvdelhedgtdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuueftkffvkffujffvgffngfevqffopdfqfgfvnecuuegrihhlohhuthemuceftddunecunecujfgurhepkfffgggfufhfvffhjggtgfesthekredttddvjeenucfhrhhomheptfhosgcuvehlihhffhgvuceorhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomheqnecuggftrfgrthhtvghrnhepieelgeeuvdfftddvtdevveegledtiedutdeuveelteffhfegkeetieehudehudfhnecukfhppeekiedrudekgedrudegfedrhedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehhvghloheplgduledvrdduieekrddurddvtdekngdpihhnvghtpeekiedrudekgedrudegfedrhedvpdhmrghilhhfrhhomheprhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomhdpnhgspghrtghpthhtohepuddprhgtphhtthhopehphihthhhonhdqlhhishhtsehphihthhhonhdrohhrghdprhgvvhfkrfephhhoshhtkeeiqddukeegqddugeefqdehvddrrhgrnhhgvgekiedqudekgedrsghttggvnhhtrhgrlhhplhhushdrtghomhdprghuthhhpghushgvrheprhhosgdrtghlihhffhgvsegsthhinhhtvghrnhgvthdrtghomhdpghgvohfkrfepifeupdfovfetjfhoshhtpehrvgdqphhrugdqrhhgohhuthdqtddtvd
X-RazorGate-Vade-Verdict: clean 0
X-RazorGate-Vade-Classification: clean
X-SNCR-hdrdom: btinternet.com
User-Agent: Mozilla Thunderbird
Content-Language: en-GB
In-Reply-To: <e5706680-aedd-4697-a413-abd23f43b579@btinternet.com>
X-Forwarded-Message-Id: <e5706680-aedd-4697-a413-abd23f43b579@btinternet.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <0b2a163c-6e83-4739-960d-35a038d4ff0b@btinternet.com>
X-Mailman-Original-References: <e5706680-aedd-4697-a413-abd23f43b579@btinternet.com>
View all headers

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!

1

rocksolid light 0.9.8
clearnet tor