]> granicus.if.org Git - python/commitdiff
Issue #11571: Ensure that the turtle window becomes the topmost window
authorNed Deily <nad@acm.org>
Sun, 20 Apr 2014 02:11:14 +0000 (19:11 -0700)
committerNed Deily <nad@acm.org>
Sun, 20 Apr 2014 02:11:14 +0000 (19:11 -0700)
when launched on OS X.  (Original patch by Ronald Oussoren)

Lib/turtle.py
Misc/NEWS

index ab7b6ba42a6ccbba57467670c7f4a8dd5f8d53d6..599f645fd0ca6d5d93e88a20b1201b41bbf10e41 100644 (file)
@@ -109,6 +109,7 @@ import types
 import math
 import time
 import inspect
+import sys
 
 from os.path import isfile, split, join
 from copy import deepcopy
@@ -992,6 +993,12 @@ class TurtleScreen(TurtleScreenBase):
         self._colormode = _CFG["colormode"]
         self._keys = []
         self.clear()
+        if sys.platform == 'darwin':
+            # 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')
 
     def clear(self):
         """Delete all drawings and all turtles from the TurtleScreen.
index 1b5ac6c497f8d3aa02321b576ba0112fe536d88d..5edfb042a8dd415f6b29968cbe3bafec837fb713 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -168,6 +168,9 @@ Library
 - Issue #21311: Avoid exception in _osx_support with non-standard compiler
   configurations.  Patch by John Szakmeister.
 
+- Issue #11571: Ensure that the turtle window becomes the topmost window
+  when launched on OS X.
+
 Extension Modules
 -----------------