brandon w wrote: > I am trying to print in the same place to make a clock in a tkinter > window. I will loop the following code to update the time. > > This seems to work but it is not printing in the same place: > > #!/usr/bin/python > #Python 2.6.6 > > import time > > for t in range(5): > digits = time.strftime('%H:%M:%S') > print "\r", digits > time.sleep(0.1)
The print statement automatically adds a newline. Try sys.stdout.write("\r" + digits) sys.stdout.flush() instead of print. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor