Ciao a tutti. Ho questo script che funziona bene sotto Windows, ma, a causa dell’assenza di MSCVRT, non posso portare sotto Mac o Linux.
Qualcuno ha qualche idea sul come poterlo modificare per far sì che funzioni anche sotto questi 2 sistemi operativi? *** # -*- Coding: UTF8 -*- # Utility di lettura tastiera 20/06/2014 # Grazie agli amici della lista Python. # Versione 1.0 import msvcrt, time def key(attesa=99999, msg=""): ''' Attende per il numero di secondi specificati se tempo e' scaduto, o si preme un tasto, esce. msg e' il messaggio da mostrare. Restituisce il tasto premuto. ''' if msg != "": print msg, t = time.time(); a = "" while (time.time() - t <= attesa): if msvcrt.kbhit(): a = msvcrt.getch() if a != "": break time.sleep(0.025) return a *** Grazie. Gabriele. _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python