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

Skip to content

Commit 8450c53

Browse files
committed
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.
1 parent cf26115 commit 8450c53

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

Lib/turtledemo/__main__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,13 @@ def show(help_label=help_label, help_file=help_file):
260260
return menu
261261

262262
def refreshCanvas(self):
263-
if not self.dirty: return
264-
self.screen.clear()
265-
self.dirty=False
263+
if self.dirty:
264+
self.screen.clear()
265+
self.dirty=False
266266

267267
def loadfile(self, filename):
268-
self.refreshCanvas()
268+
self.clearCanvas()
269+
turtle.TurtleScreen._RUNNING = False
269270
modname = 'turtledemo.' + filename
270271
__import__(modname)
271272
self.module = sys.modules[modname]
@@ -318,9 +319,7 @@ def stopIt(self):
318319
self.exitflag = False
319320
self.configGUI(NORMAL, NORMAL, DISABLED, DISABLED,
320321
"STOPPED!", "red")
321-
turtle.TurtleScreen._RUNNING = False
322-
else:
323-
turtle.TurtleScreen._RUNNING = False
322+
turtle.TurtleScreen._RUNNING = False
324323

325324
def _destroy(self):
326325
self.root.destroy()

Lib/turtledemo/nim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def main():
219219
mainscreen.mode("standard")
220220
mainscreen.setup(SCREENWIDTH, SCREENHEIGHT)
221221
nim = Nim(mainscreen)
222-
return "EVENTLOOP!"
222+
return "EVENTLOOP"
223223

224224
if __name__ == "__main__":
225225
main()

0 commit comments

Comments
 (0)