Created
January 13, 2016 19:56
-
-
Save resmo/d3b40973318148a623e1 to your computer and use it in GitHub Desktop.
shows a timer counting down in a window using tinker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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