پاسخ داده شده: داشتن همزمان دو تا ترتل در کتابخانه ی turtle در پایتون
خروجی این کد را ببین:
import turtle TURTLE_SIZE = 20 t1 = turtle.Turtle(shape="turtle") t1.penup() t1.goto(50,150) t1.pendown() t1.showturtle() 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()