Turtle object has no attribute onkey error

0 votes
import turtle as t

turtle2=t.Turtle()

def example():

     print ("this is an example")

t.onkey(example,"a")   #works fine

turtle2.onkey(example,"b")    #shows the error

t.listen()

turtle2.listen()

t.mainloop()

This is an example of my code
Jan 13, 2022 in Python by Marios

edited 5 days ago 9 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP