If I click on each turtle, I want it to function separately. But when I clicked on the turtle, they say:'ValueError: -142.0 is not in list.' I want to click the turtle but it returns the location of the mouse. What should I do?
import turtle as t
import random
tt=[]
num=[]
def leftclick(self,x):
if num[tt.index(self)]==0:
self.hideturtle()
else:
self.color('red')
for i in range(10):
for j in range(10):
tt.append(t.Turtle())
tt[i*10+j].speed(0)
tt[i*10+j].goto(-260+j*55,260-i*55)
num.append(random.choice([0,0,0,0,0,0,0,0,0,1]))
tt[i*10+j].onclick(leftclick)
onclilck(leftclick) Is there anything wrong?