non-blocking getkey?
Ulli Horlacher
framstag at rus.uni-stuttgart.de
Thu Dec 10 03:28:29 EST 2015
Ulli Horlacher <framstag at rus.uni-stuttgart.de> wrote:
> > But... is there a windows program with which one can select files and the
> > result is written to STDOUT?
>
> Found it:
>
> from Tkinter import Tk
> from tkFileDialog import askopenfilename
>
> Tk().withdraw()
> file = askopenfilename()
My users do not like it :-(
They want to drag&drop files.
Therefore I have added it as another option to enter files:
[f] select a file
[d] select a directory
[e] enter a file or directory (with drag&drop or copy&paste)
With [f] starts askopenfilename and [d] starts askdirectory
The problem with [e] is: my users do not press ENTER after pasting.
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.
It must work on Windows and Linux.
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher at 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/
--
Ullrich Horlacher Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: horlacher at 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/
More information about the Python-list
mailing list