diff -r e5d963cb6afc Lib/idlelib/Bindings.py --- a/Lib/idlelib/Bindings.py Sat May 24 00:32:29 2014 +0200 +++ b/Lib/idlelib/Bindings.py Tue May 27 19:13:34 2014 -0700 @@ -82,6 +82,7 @@ ('_About IDLE', '<>'), None, ('_IDLE Help', '<>'), + ('Turtle Demo', '<>'), ('Python _Docs', '<>'), ]), ] diff -r e5d963cb6afc Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py Sat May 24 00:32:29 2014 +0200 +++ b/Lib/idlelib/EditorWindow.py Tue May 27 19:13:34 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,12 @@ from idlelib import PathBrowser PathBrowser.PathBrowser(self.flist) + def open_turtle_demo(self, event = None): + import subprocess + + cmd = "./python.exe -c 'from turtledemo.__main__ import main; main()'" + p = subprocess.Popen(cmd, shell=True) + def gotoline(self, lineno): if lineno is not None and lineno > 0: self.text.mark_set("insert", "%d.0" % lineno) @@ -713,7 +720,7 @@ self.center() def ispythonsource(self, filename): - if not filename or os.path.isdir(filename): + if not filename or os.path.isdir(filename): return True base, ext = os.path.splitext(os.path.basename(filename)) if os.path.normcase(ext) in (".py", ".pyw"): diff -r e5d963cb6afc Lib/turtledemo/__main__.py --- a/Lib/turtledemo/__main__.py Sat May 24 00:32:29 2014 +0200 +++ b/Lib/turtledemo/__main__.py Tue May 27 19:13:34 2014 -0700 @@ -309,7 +309,8 @@ turtle.TurtleScreen._RUNNING = False #print "stopIt: exitflag = False" -if __name__ == '__main__': +def main(): + global demo demo = DemoWindow() RUN = True while RUN: @@ -328,5 +329,8 @@ #print("GOING ON ..") demo.clearCanvas() except: - print("BYE!") + print("Exiting...") RUN = False + +if __name__ == '__main__': + main()