Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #
- import Tkinter as tk
- import subprocess
- import datetime
- import time
- import sys
- def getButton():
- utc_time_on_your_pc = datetime.datetime.utcnow().replace(microsecond=0)
- timer = datetime.datetime(2013, 5, 30, 14, 0, 0) - utc_time_on_your_pc
- if timer < datetime.timedelta(0):
- timer = datetime.datetime(2013, 6, 4, 2, 0, 0) - utc_time_on_your_pc
- return ": : : "+str(timer)+" : : :"
- def task():
- """
- This is a wrapper to repeatedly run another function
- """
- button["text"] = getButton()
- root.after(500, task)
- def quit():
- """
- When the button is pressed this will exit to system
- """
- global root
- root.quit()
- sys.exit(0)
- if __name__ == '__main__':
- root = tk.Tk()
- while 1:
- button = tk.Button(root, text=getButton(), command=quit)
- button.pack()
- root.after(2000, task)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement