【发布时间】:2020-08-28 15:04:37
【问题描述】:
如何在选定的时间设置海龟的结束。例如如何在 10 秒后结束海龟。
import time
import turtle
t1 = turtle
hours = 10
minutes = 15
seconds = 20
while True:
t1.clear()
t1.write(str(hours).zfill(2) + ":" + str(minutes).zfill(2) + ":" + str(seconds).zfill(2))
seconds = seconds + 1
time.sleep(1)
if seconds == 60:
seconds =0
minutes = minutes + 1
if minutes == 60:
minutes = 0
hours = hours + 1
if hours == 24:
hours = 0
hours = hours + 1
time.sleep(4)
break
【问题讨论】:
-
请提供更多细节。你的代码应该做什么?你希望最终的结果是什么?
-
您想在 10 秒后结束程序吗?
-
是的,我想要
标签: python python-turtle