Python中的跨平台桌面通知程序 [英] Cross-platform desktop notifier in Python
问题描述
我正在寻找Python中类似 Growl 的Windows气球提示类的通知库.想象一下编写如下代码:
I am looking for Growl-like, Windows balloon-tip-like notifications library in Python. Imagine writing code like:
>>> import desktopnotifier as dn
>>> dn.notify('Title', 'Long description goes here')
..,这将在Mac,Windows和Linux上通过相应的工具提示进行通知.是否存在这样的库?如果没有,我该如何写自己的书?
.. and that would notify with corresponding tooltips on Mac, Windows and Linux. Does such a library exist? If not, how would I go about writing one myself?
- Mac是否带有默认通知程序?是我应该单独安装的 Growl 吗?
- 在Windows上,我认为这可能需要 pywin32 ? ?
- 在Linux上(假设使用GNOME),是否存在执行此操作的GNOME API(使用gnome-python)?
- 我可以在所有平台上将通知设置为粘滞"(即永不消失)吗?
- Does Mac come with a default notifier? Is Growl something that I should install separately?
- On Windows, I assume this may require pywin32?
- On Linux, assuming GNOME, is there a GNOME API (using gnome-python) that does this?
- Can I make notifications 'sticky' (i.e., don't fade out ever) on all platforms?
更新:我的首选是不依靠像这样的简单任务的PyQT4和wxPython之类的巨型GUI框架.
Update: My preference is to not depend on gigantic GUI frameworks like PyQT4 and wxPython for a simple task such as this.
推荐答案
Here's a desktop notifier I wrote a few years ago using wxPython - it behaves identically across Windows and Linux and should also run on OSX. It contains a threaded event loop that can be used to animate a notification window containing an icon and message that can be clicked on. It probably needs a couple of tweaks to customize it for your own purpose but the ground work is done.
这篇关于Python中的跨平台桌面通知程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!