From 152dfd1dac6b45177215486b68ac0ebda38dd507 Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Sat, 13 Sep 2014 23:39:16 -0700 Subject: Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X. --- Lib/turtle.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Lib/turtle.py') diff --git a/Lib/turtle.py b/Lib/turtle.py index c9e88d9dd1..f4400c90fd 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -997,8 +997,9 @@ class TurtleScreen(TurtleScreenBase): # Force Turtle window to the front on OS X. This is needed because # the Turtle window will show behind the Terminal window when you # start the demo from the command line. - cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '1') - cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '0') + rootwindow = cv.winfo_toplevel() + rootwindow.call('wm', 'attributes', '.', '-topmost', '1') + rootwindow.call('wm', 'attributes', '.', '-topmost', '0') def clear(self): """Delete all drawings and all turtles from the TurtleScreen. -- cgit v1.2.1