[Idle-dev] Window focus (was: A satisfied user)

David Scherer dscherer@cmu.edu
Fri, 17 Mar 2000 17:14:30 -0500


Bruce wrote:

> As far as the user interface goes, the only thing I can think of to raise
> the interactivity even higher has to do with a detail of window focus. If
I
> click on a graphics output window to close it, I then have to click in the
> source window to get focus there again. Could closing the graphics window
> automatically restore focus to the source window that was last edited?

Guido responded:

> I believe that this particular behavior is a (mis)feature of the
> Windows desktop, not of IDLE (or even of Tkinter).  In my experience
> it's pretty random whether closing a window activates the window below
> it or not...  IDLE itself has no data structure that manages the stack
> of open windows (which may include windows owned by other apps
> anyway).

In this particular case, it is possible for IDLE to find out that the window
has closed, because the user program terminates and disconnects.  It might
make sense for it to explicitly set the focus to the editor window when this
happens.

Unfortunately, I don't know of a way for an application to claim the focus,
or raise its windows above another application's using Tkinter, even though
that much is possible on Windows.  Calling editwin.wakeup() will raise
editwin above other windows in IDLE, and give it focus if the focus belongs
to IDLE generally, but it won't help when (for example) the desktop or the
taskbar has the focus.

Does anyone know of a simple solution to that problem?

Dave