威望0
积分7946
贡献0
在线时间763 小时
UID1
注册时间2021-4-14
最后登录2024-11-21
管理员
- UID
- 1
- 威望
- 0
- 积分
- 7946
- 贡献
- 0
- 注册时间
- 2021-4-14
- 最后登录
- 2024-11-21
- 在线时间
- 763 小时
|
from turtle import *
from datetime import datetime
import time
def drawGap():
penup()
fd(5)
def drawLine(draw):
drawGap()
pendown() if draw else penup()
fd(40)
drawGap()
right(90)
def drawDigit(d):
speed(50)
drawLine(True) if d in [2,3,4,5,6,8,9] else drawLine(False)
drawLine(True) if d in [0,1,3,4,5,6,7,8,9] else drawLine(False)
drawLine(True) if d in [0,2,3,5,6,8,9] else drawLine(False)
drawLine(True) if d in [0,2,6,8] else drawLine(False)
left(90)
drawLine(True) if d in [0,4,5,6,8,9] else drawLine(False)
drawLine(True) if d in [0,2,3,5,6,7,8,9] else drawLine(False)
drawLine(True) if d in [0,1,2,3,4,7,8,9] else drawLine(False)
left(180)
penup()
fd(20)
def drawDate(date):
pencolor('pink')
for i in date:
if i=="-":
write('时',font=('Arial',24,'bold'))
pencolor("#e78ea5")
fd(40)
elif i=='=':
write('分', font=('Arial', 24, 'bold'))
pencolor("#c5c9c7")
fd(40)
elif i=='+':
write('秒', font=('Arial', 24, 'bold'))
else:
drawDigit(eval(i))
def main():
setup(800,350,200,200)
while True:
reset()
penup()
fd(-300)
pensize(8)
tracer(False)
hideturtle()
drawDate(datetime.now().strftime('%H-%M=%S+'))
def main ():
turtle.setup(800,350,200,200)
turtle.penup()
turtle.fd(-320)
turtle.pensize(8)
drawDate(datetime.datetime.now().strftime('%Y-%m=%d+'))
turtle.hideturtle()
time.sleep(1)
done()
turtle.write("201317030126申巧燕",font=("华文行楷",24,"bold",))
main()
|
|