[Tutor] How to hide cursor in Terminal?
brandon w
bbbgggwww at gmail.com
Fri Feb 17 12:38:21 CET 2012
I made a timer that counts down from five minutes. This code runs fine but
I a seeing a cursor blinking on the first number as the code is running.
How do I avoid this?
I am using gnome-terminal and Python 2.6.6.
#!/usr/bin/python
import time
import sys
import os
def countd():
seconds = 59
minutes = 4
five_minutes = 0
os.system('clear')
while five_minutes != 300:
sys.stdout.write("%d:%02.f\r" % (minutes, seconds))
sys.stdout.flush()
seconds -= 1
if seconds == -1:
minutes -= 1
seconds = 59
five_minutes += 1
time.sleep(1)
countd()
Brandon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120217/21aa9d85/attachment.html>
More information about the Tutor
mailing list