如何让两只海龟在 Python 中同时画画?

How do you make two turtles draw at once in Python?

如何让两只海龟同时画画?我知道如何让海龟画画以及如何画两只或更多只,但我不知道如何让它们同时画画。 请帮忙!

这是一个使用计时器事件的极简示例:

import turtle

t1 = turtle.Turtle(shape="turtle")
t2 = turtle.Turtle(shape="turtle")

t1.setheading(45)
t2.setheading(-135)

def move_t1():
    t1.forward(1)
    turtle.ontimer(move_t1, 10)

def move_t2():
    t2.forward(1)
    turtle.ontimer(move_t2, 10)

turtle.ontimer(move_t1, 10)
turtle.ontimer(move_t2, 10)

turtle.exitonclick()