importturtle, time
import
winsound
import
math
defdrawgap():
turtle.penup()
turtle.fd(5)
defdrawline(draw):
drawgap()
turtle.pendown()
if draw else
turtle.penup()
turtle.fd(40)
drawgap()
turtle.right(90)
defdrawdigit(d):
drawline(true)
if d in [2, 3, 4, 5, 6, 8, 9] else drawline(false) #
g drawline(true) if d in [0, 1, 3, 4, 5, 6, 7, 8, 9] else drawline(false) #
c drawline(true) if d in [0, 2, 3, 5, 6, 8, 9] else drawline(false) #
d drawline(true) if d in [0, 2, 6, 8] else drawline(false) #
e turtle.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)
turtle.left(180)
turtle.penup()
turtle.fd(20)
defdrawdate(date):
turtle.pencolor(
'red')
if'+'
indate:
for i in
date:
if i == '-'
: turtle.write('時
', font=('
arial
', 18, '
normal'))
turtle.pencolor(
'green')
turtle.fd(40)
elif i == '='
: turtle.write('分
', font=('
arial
', 18, '
normal'))
turtle.pencolor(
'blue')
turtle.fd(40)
elif i == '+'
: turtle.write('秒
', font=('
arial
', 18, '
normal'))
turtle.pencolor(
'yellow')
turtle.fd(40)
else
: drawdigit(eval(i))
else
: turtle.goto(-180,-50)
turtle.write(date, font=('
arial
', 70, '
normal
')) #
列印超時文字
definit():
turtle.setup(1280, 720, 0, 0) #
設定畫布大小 200 200 為螢幕位置
turtle.speed(10)
turtle.penup()
turtle.goto(0, 0)
turtle.fd(-200) #
畫筆起始位置
turtle.pensize(5)
defmain(book_time):
over_flag =false
beep_flag =true
#count = book_time - time.time() + 0 # 畫面延時n秒自動關閉
try:
while
true:
over_time = book_time -time.time()
#count -= 1
if over_time >0:
time_string = time.strftime("
%m=%s+
", time.localtime(over_time))
else
: time_string = '
time out !!
'over_flag =true
turtle.clear()
init()
turtle.getscreen().tracer(30, 0)
drawdate(time_string)
#格式化時間 2017-05=02+ 控制輸入年日月
time.sleep(1)
turtle.hideturtle()
if over_flag and
beep_flag:
for i in range(100):
winsound.beep(int(600 * math.sin(i / 6.28) + 700), 100)
beep_flag =false
except
:
pass
minites = 60 * 0.1book_time = time.time() +minites
main(book_time)
倒計時 心跳倒計時
我從悶熱的午後醒來,可還是頭痛得厲害,睡意再次湧上心頭,我告訴自己不能再昏睡下去,於是決定出門去清醒一下。現在的天氣雖說有些燥熱,但是陰涼處還是比較涼爽,我慢慢地走,接著慢跑了起來,夕陽散發著最後一縷餘暉。我邊看著眼前的城市邊際的美景邊深呼吸著,隨著耳機裡傳來的 律動著。突然有個聲音從我腦海裡響起,...
js倒計時,秒倒計時,天倒計時
html 1 html 2 距某某開幕式還有 天 html html html id timer style color red 這次利用系統時間自校驗倒計時,無需手工調校使得倒計時更為精確,及詳細注釋如下 id clock 00 01 11 00 id startb type button val...
php mysql倒計時 php 倒計時程式
測試頁面 獲取系統時間,將時間以指定格式顯示到頁面。function systemtime 獲取系統時間。var datetime new date var yy datetime.getfullyear var mm datetime.getmonth var dd datetime.getdat...