]> granicus.if.org Git - python/commitdiff
Issue #22065: Menus, unlike Menubottons, do not have a state option.
authorTerry Jan Reedy <tjreedy@udel.edu>
Wed, 27 Aug 2014 05:43:50 +0000 (01:43 -0400)
committerTerry Jan Reedy <tjreedy@udel.edu>
Wed, 27 Aug 2014 05:43:50 +0000 (01:43 -0400)
Since a new demo can now be loaded while one is running,
adjust loadfile to do the same cleanup as stopIt.

Lib/turtledemo/__main__.py
Lib/turtledemo/nim.py

index d64f887c58e845c4a3040f58777171bfb7f65994..586b2a86629722d358d63ebadb2ed3029b9de601 100755 (executable)
@@ -260,12 +260,13 @@ class DemoWindow(object):
         return menu
 
     def refreshCanvas(self):
-        if not self.dirty: return
-        self.screen.clear()
-        self.dirty=False
+        if self.dirty:
+            self.screen.clear()
+            self.dirty=False
 
     def loadfile(self, filename):
-        self.refreshCanvas()
+        self.clearCanvas()
+        turtle.TurtleScreen._RUNNING = False
         modname = 'turtledemo.' + filename
         __import__(modname)
         self.module = sys.modules[modname]
@@ -318,9 +319,7 @@ class DemoWindow(object):
             self.exitflag = False
             self.configGUI(NORMAL, NORMAL, DISABLED, DISABLED,
                            "STOPPED!", "red")
-            turtle.TurtleScreen._RUNNING = False
-        else:
-            turtle.TurtleScreen._RUNNING = False
+        turtle.TurtleScreen._RUNNING = False
 
     def _destroy(self):
         self.root.destroy()
index 25ff3128f6c0b5fe87e9fc499c1b28183230f583..9ae6cc5c01b9039981f31f4c28a470ac249ee5dc 100644 (file)
@@ -219,7 +219,7 @@ def main():
     mainscreen.mode("standard")
     mainscreen.setup(SCREENWIDTH, SCREENHEIGHT)
     nim = Nim(mainscreen)
-    return "EVENTLOOP!"
+    return "EVENTLOOP"
 
 if __name__ == "__main__":
     main()