當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python turtle.ontimer用法及代碼示例

用法:

turtle.ontimer(fun, t=0)

參數

  • fun- 沒有參數的函數
  • t- 一個數字 >= 0

安裝在t 毫秒後調用fun 的計時器。

>>> running = True
>>> def f():
...     if running:
...         fd(50)
...         lt(60)
...         screen.ontimer(f, 250)
>>> f()   ### makes the turtle march around
>>> running = False

相關用法


注:本文由純淨天空篩選整理自python.org大神的英文原創作品 turtle.ontimer。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。