一萌新,想利用turtle库的暴走模式(tracer)画图,可是一运行tracer就报错。
报错信息如下:
File "C:\Users\Administrator\Desktop\draw\draw\draw.py", line 11, in <module>
t.tracer(0)
AttributeError: 'Turtle' object has no attribute 'tracer'
网上有很多人说不能把py文件命名为turtle,我寻思着自己电脑上除了turtle库和turtle库安装文件夹,就没有叫turtle的文件了
截图如下:
详细信息如下:
Message='Turtle' object has no attribute 'tracer'
Source=C:\Users\Administrator\Desktop\draw\draw\draw.py
StackTrace:
File "C:\Users\Administrator\Desktop\draw\draw\draw.py", line 11, in
t.tracer(0)
代码如下:
(注:代码是题主照着书敲的)
from turtle import *
sc = Screen()
t = Turtle()
sc.bgpic("fc.png")
t.hideturtle()
t.penup()
t.goto(-19,95)
t.pendown()
t.tracer(0)
for i in range(1000):
t.clear()
t.color("lightseagreen")
t.begin_fill()
t.circle(120)
t.end_fill()
t.left(90)
t.color("gold")
t.begin_fill()
t.circle(120)
t.end_fill()
t.left(90)
t.color("coral")
t.begin_fill()
t.circle(120)
t.end_fill()
t.left(90)
t.color("indigo")
t.begin_fill()
t.circle(120)
t.end_fill()
t.left(90)
t.left(20)
t.update()
我之后又重新装了一次Python,还是不行!
最新情况如下: