summaryrefslogtreecommitdiffstats
path: root/Lib/turtledemo
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2014-08-27 05:43:50 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2014-08-27 05:43:50 (GMT)
commit8450c5331548e396d31639776c91e191a5f3147e (patch)
tree5a904440ebac1787feae7ef3fa13aa7a00707560 /Lib/turtledemo
parentcf26115651c4c5cfc92776fd7204d7a218241e88 (diff)
downloadcpython-8450c5331548e396d31639776c91e191a5f3147e.zip
cpython-8450c5331548e396d31639776c91e191a5f3147e.tar.gz
cpython-8450c5331548e396d31639776c91e191a5f3147e.tar.bz2
Issue #22065: Menus, unlike Menubottons, do not have a state option.
Since a new demo can now be loaded while one is running, adjust loadfile to do the same cleanup as stopIt.
Diffstat (limited to 'Lib/turtledemo')
-rwxr-xr-xLib/turtledemo/__main__.py13
-rw-r--r--Lib/turtledemo/nim.py2
2 files changed, 7 insertions, 8 deletions
diff --git a/Lib/turtledemo/__main__.py b/Lib/turtledemo/__main__.py
index d64f887..586b2a8 100755
--- a/Lib/turtledemo/__main__.py
+++ b/Lib/turtledemo/__main__.py
@@ -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()
diff --git a/Lib/turtledemo/nim.py b/Lib/turtledemo/nim.py
index 25ff312..9ae6cc5 100644
--- a/Lib/turtledemo/nim.py
+++ b/Lib/turtledemo/nim.py
@@ -219,7 +219,7 @@ def main():
mainscreen.mode("standard")
mainscreen.setup(SCREENWIDTH, SCREENHEIGHT)
nim = Nim(mainscreen)
- return "EVENTLOOP!"
+ return "EVENTLOOP"
if __name__ == "__main__":
main()