TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: TMSMITH36@TMSMITH36.PLUS.
from: PETE
date: 2017-10-25 01:19:00
subject: Re: Screen control

In article ,
T M Smith   wrote:
>In message 
>          Martin Gregorie  wrote:
>
>> On Sun, 22 Oct 2017 15:50:39 -0400, Dennis Lee Bieber wrote:
>
>>> On Sun, 22 Oct 2017 17:41:01 -0000 (UTC), Martin Gregorie
>>>  declaimed the following:
>>>
>>>
>>>>> elif "overwrite" in sys.argv:
>>>>>     print print for x in xrange(100):
>>>>>         sys.stdout.write("\rPseudo-Temperature: %10.3f"
>>>>>                          % (x * 3.14159 - 25.5))
>>>
>>>                 sys.stdout.flush()
>>>
>>>>>         time.sleep(1)
>>>>> else:
>>>>>     print "\nPlease supply either 'scroll' or 'overwrite' on the
>>>>>     command
>>>>> line"
>>>>>
>>>>>
>>>>> -=-=-=-=-
>>>>> C:\Users\Wulfraed\Documents\Python Progs>so.py
>>>>>
>>>>
>>>         Adding the flush() produced output on Debian Stretch running in
>>> VirtualBox. Should have no effect on Windows.
>>>
>> Excellent, thanks. Works here after adding sys.stdout.flush()
>Thankyou Martin and Dennis, it works for me also though I will also
>explore TKinter.

There's one point that wasn't noted in all the above...
You need to aake sure the line being printed always has the same length
(as was in fact the case in the example).  Otherwise you'll get garbage
left on the right.  Simple solution -- add enough trailing spaces to
cover all cases...

 -- Pete --

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.