1

Turtle.tracer の正確な使用法は何ですか? python docs にはTurn turtle animation on/off and set delay for update drawings.、アニメーションを無効にするために使用すると書かれていますが、たとえばこのコードでは、turtle.trace を使用すると引数が明確ではありません。

import turtle
turtle.width(5)
yd=xd=-64
turtle.tracer(8,25)#This is the problem
for i in range(2):
    turtle.up()
    turtle.goto(-197.5,yd)
    turtle.down()
    turtle.seth(0)
    turtle.fd(394)
    yd+=128
    turtle.up()
    turtle.goto(xd,197.5)
    turtle.down()
    turtle.seth(270)
    turtle.fd(394)
    xd+=128
4

2 に答える 2

2

使用turtle.delay(0):

import turtle
turtle.width(5)
yd=xd=-64
turtle.delay(0) # <----
for i in range(2):
    turtle.up()
    turtle.goto(-197.5,yd)
    turtle.down()
    turtle.seth(0)
    turtle.fd(394)
    yd+=128
    turtle.up()
    turtle.goto(xd,197.5)
    turtle.down()
    turtle.seth(270)
    turtle.fd(394)
    xd+=128
turtle.mainloop()

または、次を使用するturtle.update場合に使用しますturtle.tracer

...
turtle.tracer(8,25)
for i in range(2):
    ...
turtle.update()
tracer.mainloop()
于 2013-10-27T15:48:17.940 に答える