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

Skip to content

Commit b8352e7

Browse files
committed
Issue #22053: Cleanup turtledemo start and stop and fix debug shutdown warning.
1 parent 88b2b45 commit b8352e7

1 file changed

Lines changed: 5 additions & 21 deletions

File tree

Lib/turtledemo/__main__.py

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -252,27 +252,11 @@ def stopIt(self):
252252

253253
def _destroy(self):
254254
self.root.destroy()
255-
sys.exit()
256255

257256

258-
if __name__ == '__main__':
257+
def main():
259258
demo = DemoWindow()
260-
RUN = True
261-
while RUN:
262-
try:
263-
#print("ENTERING mainloop")
264-
demo.root.mainloop()
265-
except AttributeError:
266-
#print("AttributeError!- WAIT A MOMENT!")
267-
time.sleep(0.3)
268-
print("GOING ON ..")
269-
demo.ckearCanvas()
270-
except TypeError:
271-
demo.screen._delete("all")
272-
#print("CRASH!!!- WAIT A MOMENT!")
273-
time.sleep(0.3)
274-
#print("GOING ON ..")
275-
demo.clearCanvas()
276-
except:
277-
print("BYE!")
278-
RUN = False
259+
demo.root.mainloop()
260+
261+
if __name__ == '__main__':
262+
main()

0 commit comments

Comments
 (0)