I'm making a little program with tkinter and trying to get this timer to work. I'm getting a "'float' is not callable" error. Does anyone know what I'm doing wrong?
The error happens when it tries to call 'self.clock_start()'
def create_widgets(self):
#create the main frame
self.root = Tk()
self.root.title("Learning Timer")
self.clock_start = time.clock()
#create the frame we're building on
self.frame = ttk.Frame(self.root, padding="5 5 15 15")
self.frame.grid(column=0, row=0, sticky=(N,S,W,E))
#create the main program image
self.main_image = PhotoImage(file="mainimage.gif")
self.dislay_main_image = ttk.Label(self.frame, image=self.main_image)
self.dislay_main_image.grid(row=0, column=0, sticky=N)
#create the listbox
self.what = StringVar()
self.list = Listbox(self.frame, width=41, height=5)
self.list.insert(1, "Programming")
self.list.insert(2, "Mathematics")
self.list.grid(row=1, column=0, sticky=N)
self.button = ttk.Button(self.frame, text="CLICK ME", command=self.update)
self.button.grid(row=2, column=0)
self.label = ttk.Label(self.frame, text="")
self.label.grid(row=3, column=0, sticky=N)
self.time_label = ttk.Label(self.frame, text="")
self.time_label.grid(row=4, column=0, sticky=N)
self.clock_start()
self.frame.mainloop()
self.root.mainloop()
def clock_start(self):
self.time_elapsed = time.clock() - self.clock_start
self.time_label["text"] = str(self.time_elapsed)
self.frame.after(1000, self.clock_start)