Re: IDLE: clearing the screen

Liste des GroupesRevenir à cl python 
Sujet : Re: IDLE: clearing the screen
De : rob.cliffe (at) *nospam* btinternet.com (Rob Cliffe)
Groupes : comp.lang.python
Date : 08. Jun 2024, 21:18:16
Autres entêtes
Message-ID : <mailman.100.1717874304.2909.python-list@python.org>
References : 1
User-Agent : Mozilla Thunderbird
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 the SECOND line.
(This blank line is because the IDLE prints the blank value returned by "return ''" and adds a newline to it, as it does when printing the value of any expression.)
Best wishes
Rob Cliffe

Date Sujet#  Auteur
8 Jun 24 * Re: IDLE: clearing the screen4Rob Cliffe
10 Jun 24 `* Re: IDLE: clearing the screen3Michael F. Stemper
10 Jun 24  `* Re: IDLE: clearing the screen2Stefan Ram
10 Jun 24   `- Re: IDLE: clearing the screen1Michael F. Stemper

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal