On 1/1/2020 9:14 PM, Irv Kalb wrote:

With regard to the second item above, I would like to point out something odd, and request a hopefully minor change in IDLE. I am using IDLE 3.7.3 (with Python 3.7.3) on a Mac.  I have my Mac set up so that when I double-click on a Python source file, IDLE opens.
On Windows, double-left-click on *.py runs the file in the Windows console. Have you changed the installed default?

 When I double-click on a Python file in the Finder, both the Shell and the source file open in separate windows.

On Windows, if IDLE is installed, right click context menu includes 'Edit with IDLE', which only open editor. The macOS behavior may be because applications has an app menu and macOS considers Shell to be the main app menu and the app menu is in some sense attached to that.

However, when this happens, the Shell is given focus, then the source file opens (often covering the Shell window).  Therefore, I must click on the source file window to give it keyboard focus before I can run or edit the file.

I think it would be more appropriate to give focus to the chosen source file window instead.  My thinking is that if I select a Python file that I want to edit or run, then the window associated with that file should be given initial focus rather than the Shell window.

I agree. But I have no idea how Finder opens not just one, but two windows. EditorWindow.__init__ contains 'self.focus_set', which is why new windows get focus. Perhaps you can see if this is true by watching closely enough. So macOS and macOS tcl/tk must shift focus back to the tk Text window used by Shell. This is out of the control of IDLE.

Catalina 'fixed' this issue by no longer opening .py files in IDLE with double click.

(FYI:  If IDLE is already open, and I go to the Mac Finder and double-click on another Python file, then that file opens in IDLE and *is* given focus.)


My use case might be slightly different than most because I do a lot of grading of student homework files.  I will typically download a student's assignment, double-click on it, and press F5 to run it - and nothing happens.  That's because the Shell has focus instead of the student's file.  I find myself running into this (seemingly minor problem) multiple times every day.  If it is a simple change to give focus to the selected Python source file, I would greatly appreciate it.

(If you would like me to fill out a bug report for this, I would be glad to do that.)

Ge ahead, but mark is as a tkinter, macOS, Installation issue, assigned to ned.deily and not as an IDLE issue (which will assign it to me).


--
Terry Jan Reedy


_______________________________________________
IDLE-dev mailing list
IDLE-dev@python.org
https://mail.python.org/mailman/listinfo/idle-dev

Reply via email to