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

如何让两只海龟同时在Python中画画?,python,turtle-graphics,Python,Turtle Graphics,你如何让两只乌龟同时画画?我知道如何让海龟画画,如何让两只或更多的海龟画画,但我不知道如何让它们同时画画。 请帮忙 下面是一个使用计时器事件的极简示例: 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.onti

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

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

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()

你也许可以用自己的线程运行每只海龟。。。虽然一般来说这不是一个好主意。。。