[Python-checkins] bpo-43534: Make dialogs in turtle.textinput() and turtle.numinput() transitient again (GH-24923)

miss-islington webhook-mailer at python.org
Sun Apr 25 06:44:38 EDT 2021


https://github.com/python/cpython/commit/7248ce30bb84f2d5af855a867cc4e3cc40a07fb5
commit: 7248ce30bb84f2d5af855a867cc4e3cc40a07fb5
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-04-25T03:44:30-07:00
summary:

bpo-43534: Make dialogs in turtle.textinput() and turtle.numinput() transitient again (GH-24923)

(cherry picked from commit b5adc8a7e5c13d175b4d3e53b37bc61de35b1457)

Co-authored-by: Serhiy Storchaka <storchaka at gmail.com>

files:
A Misc/NEWS.d/next/Library/2021-03-18-15-46-08.bpo-43534.vPE9Us.rst
M Lib/turtle.py

diff --git a/Lib/turtle.py b/Lib/turtle.py
index ba8288daf83f2..13f662a8c2108 100644
--- a/Lib/turtle.py
+++ b/Lib/turtle.py
@@ -826,7 +826,7 @@ def textinput(self, title, prompt):
         >>> screen.textinput("NIM", "Name of first player:")
 
         """
-        return simpledialog.askstring(title, prompt)
+        return simpledialog.askstring(title, prompt, parent=self.cv)
 
     def numinput(self, title, prompt, default=None, minval=None, maxval=None):
         """Pop up a dialog window for input of a number.
@@ -847,7 +847,8 @@ def numinput(self, title, prompt, default=None, minval=None, maxval=None):
 
         """
         return simpledialog.askfloat(title, prompt, initialvalue=default,
-                                     minvalue=minval, maxvalue=maxval)
+                                     minvalue=minval, maxvalue=maxval,
+                                     parent=self.cv)
 
 
 ##############################################################################
diff --git a/Misc/NEWS.d/next/Library/2021-03-18-15-46-08.bpo-43534.vPE9Us.rst b/Misc/NEWS.d/next/Library/2021-03-18-15-46-08.bpo-43534.vPE9Us.rst
new file mode 100644
index 0000000000000..7f2e5a46add03
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-03-18-15-46-08.bpo-43534.vPE9Us.rst
@@ -0,0 +1,2 @@
+:func:`turtle.textinput` and :func:`turtle.numinput` create now a transient
+window working on behalf of the canvas window.



More information about the Python-checkins mailing list