Terry J. Reedy <tjre...@udel.edu> added the comment:

Irv also posted to idledev, where he explained his particular need: He teaches 
a class with assignment to write a .py file with certain behavior.  Submissions 
are in 1 directory.  He would like to double-click to load a file and F5 to run 
it.  Currently, he has to move the mouse and click the loaded editor before 
running and move it back.

In reply to my post yesterday, he explained how to make double-click in finder 
open in IDLE: """I did change the default for how my Mac opens ".py" files.  To 
do that I selected any ".py" and did a Get Info on it.  A tall window opens, 
and allows me to change the default application for opening the file.  I 
selected IDLE.app and chose "Change all"."""

More testing with my Macbook: both 'python3.9 -m idlelib -i file.py' in 
terminal *and* double-clicking in Finder open an editor, with 'Format' in the 
IDLE menu, open Shell (shifted right), with 'Shell' in the IDLE menu, and then 
lift the editor window, without giving it focus and changing the IDLE menu 
back.  Rereview of the video (which omits the IDLE menu) suggests the same 
because Shell is to the right of the editor.  The video is not as clear because 
the IDLE menu is omitted, the  editor has only one line, and Irv's machine is 
much faster.

I consider the inconsistency to be a bug.  The cause is this code after the 
creation of Shell.

        if macosx.isAquaTk() and flist.dict:
            # On OSX: when the user has double-clicked on a file that causes
            # IDLE to be launched the shell window will open just in front of
            # the file she wants to see. Lower the interpreter window when
            # there are open files.
            shell.top.lower()

Widgit.raise() and .lower() do not change focus.  Since there is no way to shed 
focus, we need to save the focus window, if there is one (and make sure it is 
not the withdrawn root), before creating Shell and restore it after.  There 
might be situations in which Shell should be left on top with the focus.

----------
components: +macOS
nosy: +ronaldoussoren

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39325>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to