non-blocking getkey?

Michael Torrie torriem at gmail.com
Thu Nov 19 11:31:10 EST 2015


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.










More information about the Python-list mailing list