Skip to content

Instantly share code, notes, and snippets.

@Dhravya
Created September 13, 2021 07:38
Show Gist options
  • Save Dhravya/c76f999e33d116fbc700d6f454fc9796 to your computer and use it in GitHub Desktop.
Save Dhravya/c76f999e33d116fbc700d6f454fc9796 to your computer and use it in GitHub Desktop.
Hourly word and meaning toast giver & Notification reminder
from pkg_resources import working_set
from random_word import RandomWords
from win10toast import ToastNotifier
import time
from PyDictionary import PyDictionary
r = RandomWords()
x = 0
word = r.get_random_word(hasDictionaryDef="true")
dictionary = PyDictionary()
meaning = dictionary.meaning(word)
timeinterval = 3600
while x == 0:
notification = ToastNotifier()
notification.show_toast(f'Work of the hour : {word}' , f'Meaning: {meaning}' )
time.sleep(timeinterval)
import time
# import win10toast
from win10toast import ToastNotifier
import tkinter as tk
root= tk.Tk()
root.title('SET REMINDER')
canvas1 = tk.Canvas(root, width = 400, height = 250, relief = 'flat')
canvas1.pack()
label1 = tk.Label(root, text='REMINDER SETTER!!')
label1.config(font=('times', 15))
canvas1.create_window(200, 50, window=label1)
label2 = tk.Label(root, text='What shall i remind you about? Beep-Boop')
label2.config(font=('helvetica', 10))
canvas1.create_window(200, 100, window=label2)
entry1 = tk.Entry (root)
canvas1.create_window(200, 130, window= entry1)
label3 = tk.Label(root, text='In how many minutes do you want to be reminded?')
label3.config(font=('helvetica', 10))
canvas1.create_window(200, 160, window=label3)
entry2 = tk.Entry (root)
canvas1.create_window(200, 190, window =entry2)
def close_window():
root.destroy()
button1 = tk.Button(command = close_window )
def getReminder():
# reminder = input('What shall i remind you about? Beep-Boop ')
# remindTime = float(input('in how many minutes do you want to be reminded? '))
n = ToastNotifier()
reminder = entry1.get()
remindTime = entry2.get()
root.destroy()
remindTime = float(remindTime)
remindTime = remindTime * 60
n.show_toast('Reminder set', f'Reminder will be displayed in {remindTime/60} seconds ')
time.sleep(remindTime)
n.show_toast("Reminder:", reminder, duration = 10)
# commandsToBeDone = lambda:[getReminder, root.destroy]
button1 = tk.Button(text='Get', command = getReminder , bg='brown', fg='white', font=('helvetica', 9, 'bold'))
canvas1.create_window(200, 220, window=button1)
root.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment