[Python-checkins] bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)

miss-islington webhook-mailer at python.org
Thu Feb 3 17:34:10 EST 2022


https://github.com/python/cpython/commit/4f76b3667d856a13107c65d44d802d0e73c3f104
commit: 4f76b3667d856a13107c65d44d802d0e73c3f104
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-03T14:34:03-08:00
summary:

bpo-46630: Fix initial focus of IDLE query dialogs (GH-31112)


On Windows, one had to Tab or click on the entry box
to get a cursor and be able to enter anything.
(cherry picked from commit d1df81a730499cc6286d02afa6028a1e9c22bbbf)

Co-authored-by: Terry Jan Reedy <tjreedy at udel.edu>

files:
A Misc/NEWS.d/next/IDLE/2022-02-03-15-47-53.bpo-46630.tREOjo.rst
M Lib/idlelib/NEWS.txt
M Lib/idlelib/query.py

diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 724709a29ff63..e8055a054640b 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -4,6 +4,9 @@ Released on 2022-05-16
 =========================
 
 
+bpo-46630: Make query dialogs on Windows start with a cursor in the
+entry box.
+
 bpo-46591: Make the IDLE doc URL on the About IDLE dialog clickable.
 
 bpo-45296: Clarify close, quit, and exit in IDLE.  In the File menu,
diff --git a/Lib/idlelib/query.py b/Lib/idlelib/query.py
index fefa5aac1b7f5..df02f2123ab02 100644
--- a/Lib/idlelib/query.py
+++ b/Lib/idlelib/query.py
@@ -83,6 +83,7 @@ def __init__(self, parent, title, message, *, text0='', used_names={},
 
         if not _utest:
             self.deiconify()  # Unhide now that geometry set.
+            self.entry.focus_set()
             self.wait_window()
 
     def create_widgets(self, ok_text='OK'):  # Do not replace.
@@ -100,7 +101,6 @@ def create_widgets(self, ok_text='OK'):  # Do not replace.
                            text=self.message)
         self.entryvar = StringVar(self, self.text0)
         self.entry = Entry(frame, width=30, textvariable=self.entryvar)
-        self.entry.focus_set()
         self.error_font = Font(name='TkCaptionFont',
                                exists=True, root=self.parent)
         self.entry_error = Label(frame, text=' ', foreground='red',
diff --git a/Misc/NEWS.d/next/IDLE/2022-02-03-15-47-53.bpo-46630.tREOjo.rst b/Misc/NEWS.d/next/IDLE/2022-02-03-15-47-53.bpo-46630.tREOjo.rst
new file mode 100644
index 0000000000000..81e35486eaf21
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2022-02-03-15-47-53.bpo-46630.tREOjo.rst
@@ -0,0 +1 @@
+Make query dialogs on Windows start with a cursor in the entry box.



More information about the Python-checkins mailing list