I'm looking to create a countdown clock using Python on Sublime Text 2. I've gotten it to the point where it will display:
01:00 00:59 00:58 ... 00:00
However, I want the timer to be displayed only in one position so it looks like a continuous countdown. I've tried numerous ways but can't seem to get the line to be overwritten in Sublime. Here is the code I have so far:
def countdown(p,q):
i=p
j=q
k=0
while True:
if(j==-1):
j=59
i -=1
if(j > 9):
print(str(k)+str(i)+":"+str(j), end='\r'),
else:
print(str(k)+str(i)+":"+str(k)+str(j) , end='\r'),
time.sleep(1)
j -= 1
if(i==0 and j==-1):
break
if(i==0 and j==-1):
print("Goodbye!", end="\r")
time.sleep(1)
print(countdown(1,0))