diff -r 18adb053d806 Lib/idlelib/Bindings.py --- a/Lib/idlelib/Bindings.py Sat Jul 26 19:00:15 2014 -0700 +++ b/Lib/idlelib/Bindings.py Sat Jul 26 20:19:32 2014 -0700 @@ -8,6 +8,8 @@ windows. """ +from importlib.util import find_spec + from idlelib.configHandler import idleConf # Warning: menudefs is altered in macosxSupport.overrideRootMenu() @@ -86,4 +88,7 @@ ]), ] +if find_spec('turtledemo'): + menudefs[-1][1].append(('Turtle Demo', '<>')) + default_keydefs = idleConf.GetCurrentKeySet() diff -r 18adb053d806 Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py Sat Jul 26 19:00:15 2014 -0700 +++ b/Lib/idlelib/EditorWindow.py Sat Jul 26 20:19:32 2014 -0700 @@ -222,6 +222,7 @@ text.bind("<>", self.flist.close_all_callback) text.bind("<>", self.open_class_browser) text.bind("<>", self.open_path_browser) + text.bind("<>", self.open_turtle_demo) self.set_status_bar() vbar['command'] = text.yview @@ -705,6 +706,14 @@ from idlelib import PathBrowser PathBrowser.PathBrowser(self.flist) + def open_turtle_demo(self, event = None): + import subprocess + + cmd = [sys.executable, + '-c', + 'from turtledemo.__main__ import main; main()'] + p = subprocess.Popen(cmd, shell=False) + def gotoline(self, lineno): if lineno is not None and lineno > 0: self.text.mark_set("insert", "%d.0" % lineno) diff -r 18adb053d806 Lib/turtledemo/__main__.py --- a/Lib/turtledemo/__main__.py Sat Jul 26 19:00:15 2014 -0700 +++ b/Lib/turtledemo/__main__.py Sat Jul 26 20:19:32 2014 -0700 @@ -112,6 +112,22 @@ 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)