Skip to content

Instantly share code, notes, and snippets.

@chrisdodds
Created March 3, 2018 22:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisdodds/691f611bd7632acacdd6eeea35f0c8bd to your computer and use it in GitHub Desktop.
Save chrisdodds/691f611bd7632acacdd6eeea35f0c8bd to your computer and use it in GitHub Desktop.
Simple Timer
from tkinter import *
import tkinter.font as font
import threading
window=Tk()
window.title("Remind Chris to get up.")
helv36 = font.Font(family='Helvetica', size=36, weight=font.BOLD)
def beep():
for i in range(1,5):
print("\a")
def start_timer():
button.config(bg="yellow")
t = threading.Timer(1800.0, stop_timer)
t.start()
def stop_timer():
button.config(bg="red")
beep()
button=Button(window,text="Start",height=5, width=10,font=helv36,command=start_timer, bg="green")
button.grid(row=0,column=0)
window.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment