我是初学python程序员,需要帮助!
我想让用户一遍又一遍地输入单词30秒。很简单,就像这样:
InWord = Entry(exchangep2_page1_canvas, width=21, font=("Helvetica", 30, "bold"), relief=GROOVE, textvariable=GettheWord)
InWord.pack(side='left')
InWord.focus_set()
exchangep2_page1_canvas.create_window(500, 425, window=InWord, anchor = NW)
InWord.bind('<Return>', comp_s)
def comp_s(event):
winsound.Beep(Freq, Dur)
print (GettheWord.get())
InWord.delete(0,END)
BUT!我也想每秒显示计时器和倒计时!
你能帮忙吗?非常感谢!答案 0 :(得分:0)
试试这个:
import datetime
n = datetime.datetime.now()
while 1:
# your repeated code here
a = datetime.datetime.now()
delta = a - n
if delta.seconds > 1:
n = a
print a
else:
continue