如何让两只乌龟同时画画?我知道如何让海龟画画以及如何画两只或更多,但我不知道如何让它们同时画画。
请帮忙!
这是使用计时器事件的简约示例:
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()
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)