时钟屏保(python源码)

import turtle as t
import time
import random
t.setup(1000,600)

while True:
    x = random.randint(-10,10)
    y = random.randint(-10,10)
    hour = str(time.localtime().tm_hour)
    minute = str(time.localtime().tm_min)
    second = str(time.localtime().tm_sec)
    t.penup()
    t.setpos(t.pos()[0] + x,t.pos()[1] + y)
    t.pendown()
    now = time.ctime()
    t.clear()
    t.write(hour+':'+minute+':'+second,font=("Times",36,"bold"))
t.done()

你可能感兴趣的:(干货满满,python)