Python 3.6.3:turtle 库中是否有与 root.after 执行相同操作的方法? [英] Python 3.6.3: Is there a method in the turtle library that does the same thing as root.after?
问题描述
在python中,我正在制作一个turtle程序,我需要循环一个函数,我不会使用def n():#code;时间.睡眠(时间);n()
因为我确信它会很快引发 RecursionError
,由于语法.
In python, I am making a turtle program and I need to loop a function, I wouldn't use def n():#code; time.sleep(time); n()
as I am sure it would raise a RecursionError
soon enough, due to the syntax.
我很快就学会了 tkinter
的 root.after
语法.
I soon learnt of the root.after
syntax for tkinter
.
但是,我正在为乌龟库寻找相同的语法.我已经在互联网上检查了几次,但到目前为止都没有运气.
However, I am looking for the same syntax for the turtle library. I have checked on the internet several times but no luck so far.
turtle 库中是否有满足我需要的函数?
Is there any function in the turtle library that would meet my needs?
推荐答案
呢?
turtle.ontimer(fun, t=0)
参数:fun – 一个没有参数的函数t – 一个数字 >= 0
Parameters: fun – a function with no arguments t – a number >= 0
https://docs.python.org/2/library/turtle.html#turtle.ontimer
这篇关于Python 3.6.3:turtle 库中是否有与 root.after 执行相同操作的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!