Adsense

Reminder using python ToastNotifier

import schedule
import calendar
import time
import os
from  win10toast import ToastNotifier
from datetime import datetime
from datetime import date


def job_test():
    print("job2: Train time ..."+datetime.now().strftime('%H:%M'))
    toaster = ToastNotifier()
    toaster.show_toast(title="Test",msg="Test time"+datetime.now().strftime('%H:%M'))

def job():
    print("I'm working job...", "Hello "+datetime.now().strftime('%H:%M'))
    #os.system("Cricket_score.py")
    #toaster = ToastNotifier()
    #toaster.show_toast(title="Time alert",msg="Hello "+datetime.now().strftime('%H:%M'))
    today = date.today()
    last_day = last_day_of_month(today.year, today.month)
    if today == last_day:
        print("billpayment ...", datetime.now().strftime('%H:%M'))
        toaster = ToastNotifier()
        toaster.show_toast(title="Last day for Bill Payment ",msg="Last day for Bill Payment \n "+datetime.now().strftime('%H:%M'))
   
def job1():
    print("job1: Lunch time..."+datetime.now().strftime('%H:%M'))
    toaster = ToastNotifier()
    toaster.show_toast(title="Lunch time",msg="Lunch time"+datetime.now().strftime('%H:%M'))
   
def job2():
    print("job2: Train time ..."+datetime.now().strftime('%H:%M'))
    toaster = ToastNotifier()
    toaster.show_toast(title="Train time",msg="Train time"+datetime.now().strftime('%H:%M'))
   
def job4():
    print("job4: Time alert with Cricket_score...", datetime.now().strftime('%H:%M'))
    #os.system("Cricket_score.py")
   
def social():
    print("social: Social time...", datetime.now().strftime('%H:%M'))
    toaster = ToastNotifier()
    toaster.show_toast(title="Social time ",msg="Social time "+datetime.now().strftime('%H:%M'))
   

def billpayment():
    today = date.today()
    print "today", today
    last_day = last_day_of_month(today.year, today.month)
    print last_day
    if today == last_day:
        print("billpayment ...", datetime.now().strftime('%H:%M'))
        toaster = ToastNotifier()
        toaster.show_toast(title="Last day for Bill Payment ",msg=" Last day for Bill Payment \n "+datetime.now().strftime('%H:%M'))
       
       
def last_day_of_month(year, month):
    """ Work out the last day of the month """
    last_days = [31, 30, 29, 28, 27]
    for i in last_days:
        try:
            end = datetime(year, month, i)
        except ValueError:
            continue
        else:
            return end.date()
    return None


def tutkal_booking():
    print("tutkal_booking: Time alert for Tutkal Ticket booking...", datetime.now().strftime('%H:%M'))
    toaster = ToastNotifier()
    toaster.show_toast(title="Tutkal Ticket booking ",msg="Tutkal Ticket booking "+datetime.now().strftime('%H:%M'))



Restart task-bar
----------------------
taskkill /f /im explorer.exe && start explorer.exe

1 comment:

  1. Thank you for giving me insight, tips and information on this. It helps me a lot! Can’t wait to read more updates from you.

    Melbourne Web Developer

    ReplyDelete

comment here

newest questions on wordpress