君无泪 发表于 2021-9-29 13:45:43

求解jupyter上运行turtle出现报错!

本帖最后由 君无泪 于 2021-11-18 15:41 编辑

In :
import turtle as t

t.forward(50)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/data/user/0/ru.iiec.pydroid3/cache/ipykernel_20277/2599089082.py in <module>
      1 import turtle as t
      2
----> 3 t.forward(50)

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/turtle.py in forward(distance)

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/turtle.py in __init__(self, shape, undobuffersize, visible)
   3810                  visible=_CFG["visible"]):
   3811         if Turtle._screen is None:
-> 3812             Turtle._screen = Screen()
   3813         RawTurtle.__init__(self, Turtle._screen,
   3814                            shape=shape,

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/turtle.py in Screen()
   3660   else return the existing one."""
   3661   if Turtle._screen is None:
-> 3662         Turtle._screen = _Screen()
   3663   return Turtle._screen
   3664

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/turtle.py in __init__(self)
   3686             leftright = _CFG["leftright"]
   3687             topbottom = _CFG["topbottom"]
-> 3688             self._root.setupcanvas(width, height, canvwidth, canvheight)
   3689             _Screen._canvas = self._root._getcanvas()
   3690             TurtleScreen.__init__(self, _Screen._canvas)

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/turtle.py in setupcanvas(self, width, height, cwidth, cheight)
    435
    436   def setupcanvas(self, width, height, cwidth, cheight):
--> 437         self._canvas = ScrolledCanvas(self, width, height, cwidth, cheight)
    438         self._canvas.pack(expand=1, fill="both")
    439

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/turtle.py in __init__(self, master, width, height, canvwidth, canvheight)
    335   def __init__(self, master, width=500, height=350,
    336                                           canvwidth=600, canvheight=500):
--> 337         TK.Frame.__init__(self, master, width=width, height=height)
    338         self._rootwindow = self.winfo_toplevel()
    339         self.width, self.height = width, height

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/tkinter/__init__.py in __init__(self, master, cnf, **kw)
   3127             extra = ('-class', cnf['class'])
   3128             del cnf['class']
-> 3129         Widget.__init__(self, master, 'frame', cnf, {}, extra)
   3130
   3131

/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.8/tkinter/__init__.py in __init__(self, master, widgetName, cnf, kw, extra)
   2575         for k, v in classes:
   2576             del cnf
-> 2577         self.tk.call(
   2578             (widgetName, self._w) + extra + self._options(cnf))
   2579         for k, v in classes:

AttributeError: 'NoneType' object has no attribute 'call'
页: [1]
查看完整版本: 求解jupyter上运行turtle出现报错!