En Mon, 29 Oct 2007 14:39:49 -0300, Dick Moores <[EMAIL PROTECTED]> escribió:
> But here's a case where it seems I do need the > > if msvcrt.kbhit() line At least add a small sleep() call inside the loop, to be nice to other running processes: > ========================= > #!/usr/bin/env python > #coding=utf-8 > import time > import msvcrt > timeNow = time.time() > oldTimeNow = timeNow > while True: > if msvcrt.kbhit(): > key = msvcrt.getch() > if key == 'h': > print 'Hello' > if key == 'b': > print 'Bye' > if key == '\r': # Enter key > break else: time.sleep(0.1) > timeNow = time.time() > if timeNow - oldTimeNow > 5: > print "5 seconds passed" > oldTimeNow = timeNow > ========================== -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list