ZhangZhihui's Blog  

 

import time


SLEEP = 50


def tick():
    start = time.perf_counter() # hi-resolution timer (in seconds)
    # do something
    ...
    elapsed = int(1000 * (time.perf_counter() - start)) # milliseconds
    turtle.ontimer(tick, max(0, SLEEP - elapsed))

 

posted on 2024-08-03 13:35  ZhangZhihuiAAA  阅读(9)  评论(0编辑  收藏  举报