1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
import pygtk
pygtk.require("2.0")
import pynotify
import sys
def main():
if len(sys.argv) < 2:
print "usage: test-appname.py app_name"
sys.exit(1)
app_name = sys.argv[1]
if not pynotify.init(sys.argv[1]):
print "Failed to initialize notifications."
sys.exit(1)
n = pynotify.Notification("Message from " + app_name,
"This is a test, this is only a test.")
if not n.show():
print "Failed to send notification."
sys.exit(1)
if __name__ == "__main__":
main()
|