Issue #11571: Ensure that the turtle window becomes the topmost window when launched on Mac OS X. (Patch by Ronald Oussoren) diff --git a/Lib/turtle.py b/Lib/turtle.py --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -110,6 +110,7 @@ import time import os import inspect +import sys from os.path import isfile, split, join from copy import deepcopy @@ -994,6 +995,13 @@ self._keys = [] self.clear() + if sys.platform == 'darwin': + # Force Turtle window to the front on OSX. This is needed + # because the Turtle window will show behind the Terminal + # window when you show the turtle window 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.