Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2116016
  • 博文数量: 229
  • 博客积分: 7217
  • 博客等级: 上校
  • 技术积分: 3224
  • 用 户 组: 普通用户
  • 注册时间: 2009-02-19 17:23
个人简介

个人主页https://xugaoxiang.com,微信公众号: Dev_Club 或者搜索 程序员Club

文章分类

全部博文(229)

文章存档

2017年(1)

2016年(20)

2015年(23)

2013年(1)

2012年(23)

2011年(68)

2010年(62)

2009年(31)

分类: LINUX

2010-02-08 13:37:01

Desktop Notifications is a system for consolidating an API, UI and mechanism to allow applications, applets, services, etc. to notify the user when something interesting happens.

1、Install pynotify module

    Get the package from ,named notify-python-0.1.1.tar.gz.Unpack the tarball with the command tar xvf and enter the directory,./configure,make and sudo make install.During the configure procedure,you may need install some other necessary packages like python-gtk2-dev、python2.6-dev.

2、Use the module
   

try:
        import pynotify
        if pynotify.init('Fist Test'):
            n = pynotify.Notification('Title','message')
            n.show()
        else:
            print 'Pynotify module not initialized'
    except:
        print 'Pynotify module not installed'


    You can also set the urgency level to one of three values using the following:
        n.set_urgency(pynotify.URGENCY_LOW)
n.set_urgency(pynotify.URGENCY_NORMAL)
n.set_urgency(pynotify.URGENCY_CRITICAL)
    You can close the notification before it has timed out using the following:
        n.close()
阅读(1899) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~