首页 > 解决方案 > 为什么我两次调用此函数时会出现错误

问题描述

我第一次调用函数时它可以工作,但第二次调用该函数时出现此错误:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 1705, in __call__
    return self.func(*args)
  File "/Users/larasinnott/Desktop/Katie/Katie Sinnott -  Compter Science - Coursework-2.py", line 6751, in <lambda>
    command=lambda: [root154.destroy(), firework(),
  File "/Users/larasinnott/Desktop/Katie/Katie Sinnott -  Compter Science - Coursework-2.py", line 6812, in firework
    bot = turtle.Turtle()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/turtle.py", line 3816, in __init__
    visible=visible)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/turtle.py", line 2557, in __init__
    self._update()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/turtle.py", line 2660, in _update
    self._update_data()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/turtle.py", line 2646, in _update_data
    self.screen._incrementudc()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/turtle.py", line 1292, in _incrementudc
    raise Terminator
turtle.Terminator

如果有帮助的话,我已经导入了 Tkinter、pygame、turtle 和 random。有任何想法吗?x 谢谢

标签: pythonbots

解决方案


推荐阅读