Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09ae544

Browse files
committed
Issue #11571: Ensure that the turtle window becomes the topmost window
when launched on OS X. (Original patch by Ronald Oussoren)
1 parent f31b478 commit 09ae544

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lib/turtle.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
import math
110110
import time
111111
import inspect
112+
import sys
112113

113114
from os.path import isfile, split, join
114115
from copy import deepcopy
@@ -992,6 +993,12 @@ def __init__(self, cv, mode=_CFG["mode"],
992993
self._colormode = _CFG["colormode"]
993994
self._keys = []
994995
self.clear()
996+
if sys.platform == 'darwin':
997+
# Force Turtle window to the front on OS X. This is needed because
998+
# the Turtle window will show behind the Terminal window when you
999+
# start the demo from the command line.
1000+
cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '1')
1001+
cv._rootwindow.call('wm', 'attributes', '.', '-topmost', '0')
9951002

9961003
def clear(self):
9971004
"""Delete all drawings and all turtles from the TurtleScreen.

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ Library
168168
- Issue #21311: Avoid exception in _osx_support with non-standard compiler
169169
configurations. Patch by John Szakmeister.
170170

171+
- Issue #11571: Ensure that the turtle window becomes the topmost window
172+
when launched on OS X.
173+
171174
Extension Modules
172175
-----------------
173176

0 commit comments

Comments
 (0)