Am 18.11.15 um 09:39 schrieb Ulli Horlacher:
In my program (for python 2.7) the user must enter file names with
mouse copy+paste. I use:

while True:
   file = raw_input(prompt)
   if file == '': break
   files.append(file)

How can I implement such a get_paste() function?
I need a non-blocking getkey() function.
It must work on Windows and Linux.

Non-blocking I/O from the commandline is OS specific. There are different solutions, and it's usually hacky (stty on Linux, Console API on Windows)

Why do you not use a proper GUI toolkit to do this? It is straight-forward to accept keystrokes, copy/paste and drag'n'drop with most toolkits. Especially if you target Windows users, I think they would be more than happy to get a GUI app then to open a terminal window and paste something there. The standard terminal on Windows is very ugly, can't resize the width, and pasting works only if you right-click -> paste.

        Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to