0

For some reason my code that was working perfectly fine suddenly stopped working when I opened up my project today, here is my snippet of code that is not working.

import turtle
running = True
wn = turtle.Screen()
TimeTurtle = turtle.Turtle()

def setTime():
    global Time
    global running
    if running:
        Time = Time + 1
        TimeTurtle.clear()
    TimeTurtle.write("Time: " + str(Time), align="center", font=("Arial", 15, "bold"))
    wn.onTimer(setTime, 1000)

I get the error: '_Screen' object has no attribute 'onTimer' Any help?

Jake
  • 99
  • 1
  • 2
  • 12
  • Please provide a [mcve] that demonstrates your problem. I ran your snippet and only got `NameError: name 'turtle' is not defined`. – Kevin Mar 31 '17 at 13:36
  • [module object has no attribute 'Screen'](http://stackoverflow.com/q/6006871/669576) – 001 Mar 31 '17 at 13:38
  • @Kevin Fixed, forgot to import turtle – Jake Mar 31 '17 at 13:49

1 Answers1

1
wn.onTimer(setTime, 1000)

I don't see an onTimer method listed anywhere in the turtle documentation. Perhaps you want ontimer, with a lowercase T?

wn.ontimer(setTime, 1000)
Kevin
  • 74,910
  • 12
  • 133
  • 166