I'm very new to Python, and was trying to figure out a way of making an alarm clock that could display time using Tkinter, and would open a url when the desired time was reached. The issue as far as I can tell is that the program skips the while loop, and so the url never opens. I know that it can be improved in a lot of ways, but for now I really just want to know how to get the url to open at the entered time.
from Tkinter import *
import time
import webbrowser
class App:
def __init__(self,master):
frame=Frame(master)
frame.pack()
self.w=Label(frame,text="",bg="red")
self.w.pack(side=LEFT)
self.entry=Entry(frame)
self.entry.pack(side=LEFT)
self.Button1=Button(frame,text="Enter Hour Here",command=self.hour)
self.Button1.pack(side=LEFT)
self.entry2=Entry(frame)
self.entry2.pack(side=LEFT)
self.Button2=Button(frame,text="Enter Minute Here",command=self.minutes)
self.Button2.pack(side=LEFT)
def hour(self):
None
def minutes(self):
self.update_time()
def checktime(self):
alarmminute=self.entry2.get()
alarmhour=self.entry.get()
j=0
while j<1:
if time.localtime().tm_hour==alarmhour and time.localtime().tm_min==alarmminute:
webbrowser.open("google.com")
else:
j=j+1
self.update_time()
def update_time(self):
now = time.strftime("%H:%M:%S")
self.w.config(text=now)
root.after(1000, self.checktime)
root=Tk()
app=App(root)
root.mainloop()