pynotifyを使ってみる
libnotifyのpythonバインディングで、pythonから通知表示ができるものらしい。ダウンロード
tests/にいろいろなサンプルが。python-notifyという名前でパッケージもあり(ubuntu)
import pynotify, gtk, time def hoge(n, action): print action gtk.main_quit() pynotify.init("my notify") n = pynotify.Notification("タイトル1", "テキスト", "icon.png") n.set_urgency(0) # 0=LOW 1=DEFAULT 2=CRITICAL 緊急度、色が変化? n.set_timeout(5000) # ミリ秒、表示時間 n.show() time.sleep(5) n.update("タイトル2", "<b>太字</b>や<u>下線</u>、<a href='http://hagena.ne.jp/'>リンク</a>も可能。") # 更新 n.add_action("hoge", "ほげ", hoge) # アクションの追加 n.show() gtk.main()
簡単にできた。