Ulli Horlacher <frams...@rus.uni-stuttgart.de> wrote: > My idea now is: instead of raw_input() I use a get_paste() function, which > reads input character for input character and after a (say) 1 s timeout it > returns the string. Pasting a string with the mouse is rather fast, there > should be no big delay between the characters. > > How can I implement such a get_paste() function? > I need a non-blocking getkey() function.
I found a solution for Windows: print("\nCopy&paste a filename or drag&drop a file into this window") file = get_paste() print('\n"%s"' % file) def get_paste(): import msvcrt c = msvcrt.getch() if c == '\n' or c == '\r': return '' paste = c while msvcrt.kbhit(): c = msvcrt.getch() if c == '\n' or c == '\r': break paste += c return paste -- Ullrich Horlacher Server und Virtualisierung Rechenzentrum IZUS/TIK E-Mail: horlac...@tik.uni-stuttgart.de Universitaet Stuttgart Tel: ++49-711-68565868 Allmandring 30a Fax: ++49-711-682357 70550 Stuttgart (Germany) WWW: http://www.tik.uni-stuttgart.de/ -- https://mail.python.org/mailman/listinfo/python-list