Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Michael Torrie Newsgroups: comp.lang.python Subject: Re: non-blocking getkey? Date: Thu, 19 Nov 2015 09:31:10 -0700 Lines: 24 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de rD0lHZ2vQLiW0R3Z1VdXJQ2TapGei+MqC7UmCEqgP3sg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'win32': 0.03; 'calls.': 0.07; 'api': 0.09; 'scripts': 0.09; 'stdout': 0.09; 'python': 0.10; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'run.': 0.16; 'stdin': 0.16; 'subject:non': 0.16; 'subsystem': 0.16; 'telnet,': 0.16; 'wrote:': 0.16; 'app': 0.16; 'gui': 0.18; 'windows': 0.20; 'new,': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'header:User-Agent:1': 0.26; 'linux': 0.26; 'raw': 0.27; 'separate': 0.27; 'switch': 0.27; 'moved': 0.27; 'behaviour': 0.29; 'windows,': 0.29; 'creating': 0.30; 'window': 0.30; 'message-id:@gmail.com': 0.34; 'running': 0.34; 'could': 0.35; 'but': 0.36; 'there': 0.36; 'possible': 0.36; 'to:addr:python- list': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'associated': 0.38; 'received:192': 0.39; 'subject:-': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'back': 0.62; 'charset:windows-1252': 0.62; 'brand': 0.75; 'window,': 0.84; 'absolutely': 0.88; 'graphical': 0.91 X-Virus-Scanned: amavisd-new at torriefamily.org User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.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:99071 On 11/19/2015 08:48 AM, Ulli Horlacher wrote: > > The focus is moved to another, unrelated window, but not back to the > window in which the python scripts run. > Same behaviour on Linux (XFCE) and windows 7. That's because an app that communicates with standard in and standard out could be running over telnet, theoretically, so there would be no window at all. There's absolutely no link in stdin and stdout to a graphical window. It's not even possible on Windows as the console subsystem is completely separate from the GUI subsystem. When your app opens a Tk window, it's creating a brand new, top-level window, not associated with any existing window. One windows it might be possible to use the win32 api to enumerate the windows, find your console window and switch to it. Might even be possible on Linux using raw X11 calls.