Created
July 13, 2018 16:44
-
-
Save okplanbo/f3e311870481081fbcc6f739be02aa9a to your computer and use it in GitHub Desktop.
Simple silent alarm widget for windows using tkinter
This file contains 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
# 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