I have a script for a simple turtle race and I want the race to start when the user clicks the left-mouse-button so i have this code
def tur_race():
for step in range(0, 135):
tur1.forward(randint(1, 5))
tur2.forward(randint(1, 5))
turtle.pu()
turtle.goto(-250, -150)
turtle.write("click the mouse to start")
turtle.ht()
turtle.onscreenclick(tur_race())
turtle.mainloop()
Assume that I have all variables defined.
when I run this code the race starts automatically and doesn't wait for the click.