2013年12月31日火曜日

カウントダウンクロック ver.2014

ほとんど二年前の使いまわしで手抜き。


from Tkinter import *
from time import *
flag = False
count = 11
hny = ''
root = Tk()
root.option_add('*font', ('FixedSys', 14))
root.minsize(400,200)
root.maxsize(400,200)
buff = StringVar()
buff.set('')
lb = Label(root,textvariable = buff,bg = 'black',fg = 'white',anchor = 'c',width = 40,height = 10)
lb.pack()
def show_time():
global count
global flag
global hny
if count == 0:
lb.configure(bg = 'white', fg = 'red')
if strftime('%H:%M:%S') == '23:59:49':
flag = True
if flag:
count -= 1
if count == 0:
flag = False
hny = "Happy New Year!\n"
buff.set(count)
else:
buff.set(hny + strftime('%H:%M:%S'))
root.after(1000, show_time)
show_time()
root.mainloop()


ちょっとはマシ

0 件のコメント:

コメントを投稿