From a9649cf58e1fa55cbf5417c8d424a07d0db91a0d Mon Sep 17 00:00:00 2001 From: williamnavaraj Date: Sun, 9 Aug 2026 23:01:24 +0200 Subject: [PATCH] gh-70758: Fix creating a turtle screen after closing one (GH-30355) Creating a new turtle screen after the previous one was closed no longer raises turtle.Terminator on the first turtle command. (cherry picked from commit 1286d4398e505f70f97e50edda6b0341f16ca267) Co-authored-by: williamnavaraj Co-authored-by: Serhiy Storchaka --- Lib/turtle.py | 3 +++ .../next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst diff --git a/Lib/turtle.py b/Lib/turtle.py index db38a5a23581a7f..ba3a97db1b71127 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -1002,6 +1002,9 @@ def __init__(self, cv, mode=_CFG["mode"], rootwindow.wm_attributes(topmost=True) rootwindow.wm_attributes(topmost=False) + # A new screen means that turtle graphics is running again. + TurtleScreen._RUNNING = True + def clear(self): """Delete all drawings and all turtles from the TurtleScreen. diff --git a/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst b/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst new file mode 100644 index 000000000000000..c59f6fed93fd630 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-03-12-50-42.gh-issue-70758.2NjFW_.rst @@ -0,0 +1,2 @@ +Creating a new :mod:`turtle` screen after the previous one was closed no +longer raises ``turtle.Terminator`` on the first turtle command.