Cross-platform desktop notifier in Python(Python 中的跨平台桌面通知程序)
问题描述
我正在 Python 中寻找 Growl 之类的 Windows 气球提示式通知库.想象一下编写如下代码:
<预><代码>>>>将桌面通知程序导入为 dn>>>dn.notify('Title', '长描述在这里').. 并且会在 Mac、Windows 和 Linux 上通过相应的工具提示进行通知.有这样的图书馆吗?如果没有,我怎么自己写一个?
- Mac 是否带有默认通知程序?Growl 是否应该单独安装?
- 在 Windows 上,我认为这可能需要 pywin32?
- 在 Linux 上,假设使用 GNOME,是否有 GNOME API(使用 gnome-python)可以执行此操作?
- 我可以在所有平台上使通知具有粘性"(即永远不会淡出)吗?
更新:我倾向于不依赖像 PyQT4 和 wxPython 这样的巨大 GUI 框架来完成这样的简单任务.
这是我几年前使用 wxPython 编写的桌面通知程序 - 它在 Windows 和 Linux 上的行为相同,也应该在 OSX 上运行.它包含一个线程事件循环,可用于为包含可单击的图标和消息的通知窗口设置动画.它可能需要进行一些调整才能根据您自己的目的对其进行自定义,但基础工作已经完成.
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')
.. 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?
- 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?
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 中的跨平台桌面通知程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python 中的跨平台桌面通知程序


- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01