Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Terry Reedy Newsgroups: comp.lang.python Subject: Re: non-blocking getkey? Date: Wed, 18 Nov 2015 07:26:12 -0500 Lines: 30 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de F7RxEPXP79B/VAaq+WzTvwTwiTOUnSZ03OI+0MrSWQfg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'rewrite': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'jan': 0.11; 'systems.': 0.11; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'reedy': 0.16; 'subject:non': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'windows': 0.20; 'names.': 0.22; "skip:' 40": 0.22; 'tkinter': 0.22; 'am,': 0.23; 'select': 0.23; 'skip:( 40': 0.23; 'import': 0.24; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; "skip:' 50": 0.29; 'windows,': 0.29; 'file': 0.34; 'handle': 0.34; 'add': 0.34; 'too': 0.36; 'there': 0.36; 'limitation': 0.36; 'received:71': 0.36; 'to:addr:python-list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'names': 0.38; 'files': 0.38; 'application': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'received:fios.verizon.net': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: pool-71-185-227-36.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:98962 On 11/18/2015 6:01 AM, Ulli Horlacher wrote: > Ulli Horlacher wrote: > >> it is too complicated to rewrite my application from CLI to GUI. >> 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() To get multiple names, add 's'. On Windows, one uses control-leftclick to get multiple names. Don't know about other systems. >>> fd.askopenfilenames() # ^click 4 names ('F:/Python/dev/27/Lib/idlelib/aboutDialog.py', 'F:/Python/dev/27/Lib/idlelib/AutoComplete.py', 'F:/Python/dev/27/Lib/idlelib/AutoCompleteWindow.pyc', 'F:/Python/dev/27/Lib/idlelib/Bindings.py') The limitation is that this will not work if any of the file names contain astral (non-BMP) chars because tk cannot handle such characters. -- Terry Jan Reedy