Re: IDLE: clearing the screen

2024-06-10 Thread Michael F. Stemper via Python-list
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

Re: IDLE: clearing the screen

2024-06-10 Thread Michael F. Stemper via Python-list
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

Re: IDLE: clearing the screen

2024-06-09 Thread Alan Gauld via Python-list
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

Re: IDLE: clearing the screen

2024-06-08 Thread Rob Cliffe via Python-list
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

Re: Fwd: IDLE: clearing the screen

2024-06-05 Thread Rob Cliffe via Python-list
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

Re: Fwd: IDLE: clearing the screen

2024-06-04 Thread Cameron Simpson via Python-list
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

Fwd: IDLE: clearing the screen

2024-06-04 Thread Rob Cliffe via Python-list
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

IDLE: clearing the screen

2024-06-04 Thread Cave Man via Python-list
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

Re: use CTRL+L for clearing the screen

2012-02-29 Thread Ben Finney
Jabba Laci writes: > I would like to add a clear screen feature, which would be activated > with CTRL+L. How to do that? > Another thing: raw_input waits until but I'd like to clear the > screen at the moment when CTRL+L is pressed. That sounds like a job for the standard library ‘readline’ mod

use CTRL+L for clearing the screen

2012-02-29 Thread Jabba Laci
Hi, I'm working on an interactive script. With raw_input user input is read and the script produces some output and offers the prompt again. I would like to add a clear screen feature, which would be activated with CTRL+L. How to do that? Another thing: raw_input waits until but I'd like to clear

Re: Clearing the screen

2006-02-15 Thread Graham
you could always use ANSI escape codes: print "\\033[2J" for a screen clear, or print "\\022[2j \033[0;0H" to clear and reset the way "os.system('clear')" would work. check out http://www.termsys.demon.co.uk/vtansi.htm Seems like all that mud programming came in handy after all. Graham. --

Re: Clearing the screen

2006-02-15 Thread mwt
You know, for now, I just would like it to work in a standard Gnome terminal (my version is 2.12.0). -- http://mail.python.org/mailman/listinfo/python-list

Re: Clearing the screen

2006-02-14 Thread mwt
It clears the screen by scrolling all the characters out of sight at the top of the terminal window. So the screen is blank, but not cleared in the sense that I mean it. The behavior I want is for the display to be effectively "erased" and ready to receive the next wave of data -- like you would do

Re: Clearing the screen

2006-02-12 Thread Fredrik Lundh
"mwt" wrote: > Arrgghh... Is there any way to edit posts on this thing? are you aware that you're posting to a usenet newsgroup? > The os.system("clear") doesn't work at all in a module. works for me (as long as I'm running the code on a platform that has a clear command). in what way does it

Re: Clearing the screen

2006-02-12 Thread mwt
Arrgghh... Is there any way to edit posts on this thing? The os.system("clear") doesn't work at all in a module. -- http://mail.python.org/mailman/listinfo/python-list

Re: Clearing the screen

2006-02-12 Thread mwt
No guessing needed. If I just use os.system("clear") on its own, no problem. Also, if I use the magic formula you gave on its own, that works to. But in the app, (see below), neither command works. I'm missing something obvious, but I'm... missing it. def run(self, userinfo): """Time when

Re: Clearing the screen

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 22:26:08 -0800, mwt wrote: > I can't seem to get that to behave properly. It works fine in a python > shell, like you're demonstrating it, but not as a command in a module. Would you like to tell us how you are using it and what happens when you do, or would you like us to gue

Re: Clearing the screen

2006-02-11 Thread Steven D'Aprano
On Sat, 11 Feb 2006 18:14:02 -0200, Felipe Almeida Lessa wrote: > Em Sáb, 2006-02-11 às 12:04 -0800, mwt escreveu: >> I'm doing some python programming for a linux terminal (just learning). >> When I want to completely redraw the screen, I've been using >> os.system("clear") >> This command works

Re: Clearing the screen

2006-02-11 Thread mwt
I can't seem to get that to behave properly. It works fine in a python shell, like you're demonstrating it, but not as a command in a module. -- http://mail.python.org/mailman/listinfo/python-list

Re: Clearing the screen

2006-02-11 Thread Felipe Almeida Lessa
Em Sáb, 2006-02-11 às 12:04 -0800, mwt escreveu: > I'm doing some python programming for a linux terminal (just learning). > When I want to completely redraw the screen, I've been using > os.system("clear") > This command works when using python in terminal mode, and in IDLE. > However, when runnin

Clearing the screen

2006-02-11 Thread mwt
I'm doing some python programming for a linux terminal (just learning). When I want to completely redraw the screen, I've been using os.system("clear") This command works when using python in terminal mode, and in IDLE. However, when running a little .py file containing that command, the screen doe

Re: Clearing the screen

2005-01-01 Thread Artur M. Piwko
In the darkest hour on Sat, 25 Dec 2004 09:41:54 +1030, Ishwor <[EMAIL PROTECTED]> screamed: def cls(): > for i in range(1,40): > print " "; > Slightly ot, but perhaps this'll work for you: def cls(): print "\033[2J" -- [ Artur M. Piwko : Pipen : AMP29-RIPE : R

Customizing interpreter behavior [was: Clearing the screen]

2004-12-27 Thread Steve Holden
John Machin wrote: Ishwor wrote: i was just tinkering with it actually. ;-) In your command prompt just do Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py" It's not a very good idea to store your own scripts in the PythonXY directory -- other than tested working modules which you install in

Re: Clearing the screen

2004-12-25 Thread Ishwor
On Sun, 26 Dec 2004 13:07:56 +1030, Ishwor <[EMAIL PROTECTED]> wrote: > On 25 Dec 2004 18:20:39 -0800, John Machin <[EMAIL PROTECTED]> wrote: > > > > Ishwor wrote: > > > > > i was just tinkering with it actually. ;-) > > > In your command prompt just do > > > Pythonwin.exe /run "C:\Python24\file\Py

Re: Clearing the screen

2004-12-25 Thread Ishwor
On 25 Dec 2004 18:20:39 -0800, John Machin <[EMAIL PROTECTED]> wrote: > > Ishwor wrote: > > > i was just tinkering with it actually. ;-) > > In your command prompt just do > > Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py" > > It's not a very good idea to store your own scripts in the Py

Re: Clearing the screen

2004-12-25 Thread John Machin
Ishwor wrote: > i was just tinkering with it actually. ;-) > In your command prompt just do > Pythonwin.exe /run "C:\Python24\file\PyFiles\clear.py" It's not a very good idea to store your own scripts in the PythonXY directory -- other than tested working modules which you install in PythonXY\li

Re: Clearing the screen

2004-12-25 Thread Ishwor
heres the shell i forgot to show PythonWin 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32. Portions Copyright 1994-2004 Mark Hammond ([EMAIL PROTECTED]) - see 'Help/About PythonWin' for further copyright information. >>> clear.cls() [40 more lines of "\n"] >>> -- cheers,

Re: Clearing the screen

2004-12-25 Thread Ishwor
On Sun, 26 Dec 2004 01:47:42 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: > Scott David Daniels wrote: > > Nick Coghlan wrote: > > > >> Jeff Epler wrote: > >> > >>> I don't know about idle, but the "real" python supports the > >>> PYTHONSTARTUP environment variable. > >> > >> > >> I just tried it

Re: Clearing the screen

2004-12-25 Thread Steven Bethard
Scott David Daniels wrote: Nick Coghlan wrote: Jeff Epler wrote: I don't know about idle, but the "real" python supports the PYTHONSTARTUP environment variable. I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I just started using PYTHONSTARTUP to switch the standard prompt from

Re: Clearing the screen

2004-12-25 Thread Ishwor
On Sat, 25 Dec 2004 16:34:26 -0800, Scott David Daniels <[EMAIL PROTECTED]> wrote: > Nick Coghlan wrote: > > Jeff Epler wrote: > > > >> I don't know about idle, but the "real" python supports the > >> PYTHONSTARTUP environment variable. > > > > I just tried it - IDLE ignores PYTHONSTARTUP, as does

Re: Clearing the screen

2004-12-25 Thread Scott David Daniels
Nick Coghlan wrote: Jeff Epler wrote: I don't know about idle, but the "real" python supports the PYTHONSTARTUP environment variable. I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I just started using PYTHONSTARTUP to switch the standard prompt from '>>>' to "Py>'). I believe

Re: Clearing the screen

2004-12-25 Thread Nick Coghlan
Jeff Epler wrote: I don't know about idle, but the "real" python supports the PYTHONSTARTUP environment variable. I just tried it - IDLE ignores PYTHONSTARTUP, as does PythonWin (I just started using PYTHONSTARTUP to switch the standard prompt from '>>>' to "Py>'). I believe PYTHONSTARTUP is han

Re: Clearing the screen

2004-12-25 Thread Craig Ringer
On Sat, 2004-12-25 at 07:43, Ishwor wrote: > On 24 Dec 2004 15:33:26 -0800, Lars <[EMAIL PROTECTED]> wrote: > > Hi Iswor, > > > > If I understand you correctly then your program is writing output to a > > console/terminal window and you want to clear that window. > > I don't know of any library me

Re: Clearing the screen

2004-12-24 Thread Jeff Epler
I don't know about idle, but the "real" python supports the PYTHONSTARTUP environment variable. PYTHONSTARTUP If this is the name of a readable file, the Python commands in that file are executed before the first prompt is displayed in interactive mode. The file is executed

Re: Clearing the screen

2004-12-24 Thread Ishwor
On 24 Dec 2004 15:33:26 -0800, Lars <[EMAIL PROTECTED]> wrote: > Hi Iswor, > > If I understand you correctly then your program is writing output to a > console/terminal window and you want to clear that window. > I don't know of any library methods for that, but you might just do: well i am not d

Re: Clearing the screen

2004-12-24 Thread Lars
Hi Iswor, If I understand you correctly then your program is writing output to a console/terminal window and you want to clear that window. I don't know of any library methods for that, but you might just do: os.system("cls") #for windows or os.system("clear") #for unix Not the most advanc

Clearing the screen

2004-12-24 Thread Ishwor
Hi i use IDLE to code Python in my machine. What i haven't been able to do is call an in-built function called clear()/cls()/clr() because it mightn't exist. so what i did is coded my own function called cls() as such >>> def cls(): for i in range(1,40): print " "; now that