为什么pync不适合Mac不起作用? (Python)

发布于 2025-01-29 16:31:08 字数 401 浏览 2 评论 0原文

我正在尝试在Mac上使用Python进行通知。我已经安装了PYNC,并使用了以下代码:

from plyer import notification
import pync, time

while True:
    pync.notify("lets do something random!")
    print("Activated!")
    time.sleep(1)

Visual Studio代码调试器显示了这一点:

Activated!
Activated!
Activated!

但是,没有显示通知。我已经启用了通知,横幅和声音。为什么通知不显示?提前致谢!

I'm trying to do notifications in python on mac. I have installed pync, and used the following code:

from plyer import notification
import pync, time

while True:
    pync.notify("lets do something random!")
    print("Activated!")
    time.sleep(1)

The visual studio code debugger shows this:

Activated!
Activated!
Activated!

However, no notification shows up. I have enabled notifications, with banner and sounds. Why does the notification not display? Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

土豪 2025-02-05 16:31:08

是的,它对我在MacOS 12.3.1上有用,

请确保您从终端通知器允许的通知:

系统首选项 - >通知&焦点 - >终端运动
并允许通知

,可能是您在Mac上禁用的通知,例如您处于“焦点”模式

”

Yes, it works for me on MacOS 12.3.1

Make sure you have notification from terminal-notifier allowed:

System Preferences -> Notifications & Focus -> terminal-notifier
and allow the notifications

Also, it might be the case that you have notifications disabled on your mac e.g. you're in "focus" mode

screenshot of settings

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文