home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / doc / python-notify / examples / test-replace.py < prev    next >
Encoding:
Python Source  |  2006-04-26  |  562 b   |  28 lines

  1. #!/usr/bin/env python
  2.  
  3. import pygtk
  4. pygtk.require('2.0')
  5. import pynotify
  6. import sys
  7. import time
  8.  
  9. if __name__ == '__main__':
  10.     if not pynotify.init("Replace Test"):
  11.         sys.exit(1)
  12.  
  13.     n = pynotify.Notification("Summary", "First message")
  14.     n.set_timeout(0)
  15.  
  16.     if not n.show():
  17.         print "Failed to send notification"
  18.         sys.exit(1)
  19.  
  20.     time.sleep(3)
  21.  
  22.     n.update("Second Summary", "First mesage was replaced")
  23.     n.set_timeout(pynotify.EXPIRES_DEFAULT)
  24.  
  25.     if not n.show():
  26.         print "Failed to send notification"
  27.         sys.exit(1)
  28.