我试图在不使用Tkinter的情况下制作一个简单的闹钟。警报运行并开始每秒的倒计时,但是当它达到警报应该关闭的设定时间时,它会继续运行。如何设置闹钟并打开我的网络浏览器以在设定的时间在地鼠中播放所选歌曲?
lines = open("Links.txt").read().splitlines()
mylines = random.choice(lines)
print(mylines)
name = raw_input("Enter your name: ")
print("Hello, " + name)
alarm_hour = input("Enter the hour you want to wake up: ")
alarm_min = input("Enter the min of the hour you want to wake up: ")
print("You want to wake up at: {0:02}:{1:02}").format(alarm_hour, alarm_min)
alarm = Alarm(alarm_hour, alarm_min)
#print (time.strftime())
clock = time.strftime("%H:%M:%S")
while True:
if clock != alarm:
print "The time is: " + clock
clock = time.strftime("%H:%M:%S")
time.sleep(1)
if alarm == clock:
#webbrowser.open(newlist[pick])
print "Alarm Now"
webbrowser.open(mylines)
break