Friday, June 14, 2013

Notify Schedule Time Using Python and Notification


Suppose that your exam is knocking at the door. If you set the time in this python programme  and configure perfectly then when you start your computer it remind your exam schedule through notification.





import datetime
import sys
import pynotify

now = datetime.datetime.now().replace(microsecond=0)
then = datetime.datetime(2013,07,14,10,0,0)

diff = then - now

hours = (diff.seconds) / 3600
minutes = (diff.seconds - hours * 3600) / 60
seconds = (diff.seconds  - (hours * 3600 + minutes * 60))


def sendmessage(title, message):
    pynotify.init("image")
    notice = pynotify.Notification(title,message,"/usr/share/icons/gnome/48x48/status/important.png").show()
    return notice
sendmessage("Time remaining to exam","%s days, %s hours, %s minutes and %s seconds."% (diff.days,hours,minutes,seconds))



For Linux/Ubunt, Click on preference=>Startup Application then add your python programme . After that restart your machine and after that enjoy your time notification.

Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...

0 comments

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

 
© 2011 Python
Designed by Hizbul Bahar
Posts RSSComments RSS
Back to top