Skip to content

Instantly share code, notes, and snippets.

@resmo
Created January 13, 2016 19:56
Show Gist options
  • Select an option

  • Save resmo/d3b40973318148a623e1 to your computer and use it in GitHub Desktop.

Select an option

Save resmo/d3b40973318148a623e1 to your computer and use it in GitHub Desktop.
shows a timer counting down in a window using tinker
#!/usr/bin/python
import Tkinter as tk
import time
class App():
def __init__(self):
self.timer = 60
self.root = tk.Tk()
self.label = tk.Label(text="")
self.label.pack()
self.root.geometry('{}x{}'.format(200, 200))
self.update_clock()
self.root.mainloop()
def update_clock(self):
self.timer = self.timer - 1
self.label.configure(text=self.timer)
self.root.after(1000, self.update_clock)
app=App()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment