]> granicus.if.org Git - python/commitdiff
Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X.
authorNed Deily <nad@acm.org>
Sun, 14 Sep 2014 06:39:16 +0000 (23:39 -0700)
committerNed Deily <nad@acm.org>
Sun, 14 Sep 2014 06:39:16 +0000 (23:39 -0700)
Lib/turtle.py
Misc/NEWS

index c9e88d9dd12c6a87162b02d78564b5e126ef1d04..f4400c90fd7345d3311f1663c704b0efbdb74880 100644 (file)
@@ -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.
index 4e72496f8a4a5f17a71b89daf72345d2ed79f4a8..523965b447c989ad28363a48065de085848c515c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -32,6 +32,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #22168: Prevent turtle AttributeError with non-default Canvas on OS X.
+
 - Issue #21147: sqlite3 now raises an exception if the request contains a null
   character instead of truncate it.  Based on patch by Victor Stinner.