If I run the following in python
in Ubuntu 10.04:
>>> 开发者_如何学运维import pynotify
>>> p = pynotify.Notification ("Notice","","/home/george/Pictures/test.png")
>>> p.show()
true
The message displays as expected, except the image does not appear in the OSD. How can I display a local image?
In fact, for what I need, it would be better if I could display a remote image. (via HTTP)
How can I do that?
The following definitely works for me:
>>> import pynotify
>>> p = pynotify.Notification("Notice", "", "/usr/share/pixmaps/firefox.png")
>>> p.show()
alt text http://www.imagebanana.com/img/qfmebkr5/screenshot_009.png
Are you sure the image is there? With correct permissions?
That works for me. Maybe your backend doesn't support icons, or you are not noticing. For KDE 4, it's small but definitely there in the upper-left. Also, I don't think there's any pynotify support for remote images, so use:
urllib.urlretrieve("http://some/remote/file.png", "/some/local/file.png")
as needed.
精彩评论