summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-07-23 21:27:57 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-07-23 21:27:57 (GMT)
commitb8352e7253e61e24f6ba3f06cda6135a3c976884 (patch)
tree13f4e4ae420da45ab8f8758336ad5366d4a21757
parent88b2b45154c13947487fcdeca80f769092fb6890 (diff)
downloadcpython-b8352e7253e61e24f6ba3f06cda6135a3c976884.zip
cpython-b8352e7253e61e24f6ba3f06cda6135a3c976884.tar.gz
cpython-b8352e7253e61e24f6ba3f06cda6135a3c976884.tar.bz2
Issue #22053: Cleanup turtledemo start and stop and fix debug shutdown warning.
-rwxr-xr-xLib/turtledemo/__main__.py26
1 files changed, 5 insertions, 21 deletions
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
index 35b1651..0c151a3 100755
--- a/Lib/turtledemo/__main__.py
+++ b/Lib/turtledemo/__main__.py
@@ -252,27 +252,11 @@ class DemoWindow(object):
def _destroy(self):
self.root.destroy()
- sys.exit()
-if __name__ == '__main__':
+def main():
demo = DemoWindow()
- RUN = True
- while RUN:
- try:
- #print("ENTERING mainloop")
- demo.root.mainloop()
- except AttributeError:
- #print("AttributeError!- WAIT A MOMENT!")
- time.sleep(0.3)
- print("GOING ON ..")
- demo.ckearCanvas()
- except TypeError:
- demo.screen._delete("all")
- #print("CRASH!!!- WAIT A MOMENT!")
- time.sleep(0.3)
- #print("GOING ON ..")
- demo.clearCanvas()
- except:
- print("BYE!")
- RUN = False
+ demo.root.mainloop()
+
+if __name__ == '__main__':
+ main()