Skip to content

Instantly share code, notes, and snippets.

@okplanbo
Created July 13, 2018 16:44
Show Gist options
  • Save okplanbo/f3e311870481081fbcc6f739be02aa9a to your computer and use it in GitHub Desktop.
Save okplanbo/f3e311870481081fbcc6f739be02aa9a to your computer and use it in GitHub Desktop.
Simple silent alarm widget for windows using tkinter
# Simple silent alarm widget for windows
# Set time in seconds and text below or pass them in cmd like this: python timer 5 hello
import sys
import time
from tkinter import *
from tkinter.messagebox import showinfo
if (len(sys.argv) > 1):
delay = float(sys.argv[1])
else:
delay = 5
text = 'Alarm!'
if (len(sys.argv) > 2):
text = sys.argv[2]
else:
text = 'Alarm!'
time.sleep(delay) # time before alarm in second
win = Tk()
win.attributes('-topmost', True)
win.focus_force()
showinfo('Got it', text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment