summaryrefslogtreecommitdiffstats
path: root/Lib/turtledemo/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/turtledemo/__main__.py')
-rwxr-xr-xLib/turtledemo/__main__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
index 07560c3..63f97e2 100755
--- a/Lib/turtledemo/__main__.py
+++ b/Lib/turtledemo/__main__.py
@@ -40,6 +40,22 @@ class DemoWindow(object):
root.title('Python turtle-graphics examples')
root.wm_protocol("WM_DELETE_WINDOW", self._destroy)
+ if sys.platform == 'darwin':
+ import subprocess
+ # Make sure we are the currently activated OS X application
+ # so that our menu bar appears.
+ p = subprocess.Popen(
+ [
+ 'osascript',
+ '-e', 'tell application "System Events"',
+ '-e', 'set frontmost of the first process whose '
+ 'unix id is {} to true'.format(os.getpid()),
+ '-e', 'end tell',
+ ],
+ stderr=subprocess.DEVNULL,
+ stdout=subprocess.DEVNULL,
+ )
+
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(0, weight=1)
root.grid_columnconfigure(1, minsize=90, weight=1)