You can use time to get time left
and a label
to show it.
'%.1f' % (newtime - TIME)
is used to have always one digit after .
.
This is a simple example:
from Tkinter import*
import time
the_time=''
TIME = newtime = time.time()
class Window(Frame):
def __init__(self,master):
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def create_widgets(self):
#Create a label that displays time:
self.display_time=Label(self, text=the_time)
self.display_time.grid(row=0, column=1)
def change_value_the_time():
global the_time
newtime = time.time()
if newtime != the_time:
the_time= '%.1f' % (newtime - TIME)
self.display_time.config(text=the_time, font="40")
self.display_time.after(20, change_value_the_time)
change_value_the_time()
root=Tk()
root.title("Test")
root.geometry("200x200")
app=Window(root)
root.mainloop()