利用python编写气泡提醒小程序

28 篇文章 3 订阅
19 篇文章 0 订阅

 

今天偶尔要用到气泡提醒的功能,在网上找了一下相关的python程序代码,找到一个notify-py,具体网址在这里,兴高采烈的pip安装一下,

pip install notify-py

然后照着所提供的源代码运行一下:

from notifypy import Notify

notification = Notify()
notification.title = "Cool Title"
notification.message = "Even cooler message."

 缺发现报错了:

Traceback (most recent call last):
  File "E:/infohao/bubbleTest.py", line 3, in <module>
    notification = Notify()
  File "C:\Users\condor\AppData\Roaming\Python\Python36\site-packages\notifypy\notify.py", line 58, in __init__
    self._notifier_detect = self._selected_notification_system()
  File "C:\Users\condor\AppData\Roaming\Python\Python36\site-packages\notifypy\notify.py", line 96, in _selected_notification_system
    f"This version of Windows ({platform.release()}) is not supported."
notifypy.exceptions.UnsupportedPlatform: This version of Windows (7) is not supported. is not supported.

 原来对于操作系统有一定的要求:

  • Windows 10
  • macOS 10 >=10.10
  • Linux (libnotify)

经过多方查找,找到一个新的小程序,代码如下:

import time
from plyer import notification

if __name__ == "__main__":
    notification.notify(
        title="Please Drink Water",
        message="Water do eyes, nose, or mouth gets dry? Keeping your body hydrated helps it retain optimum levels of moisture in these sensitive areas, as well as in the blood, bones, an.",
        app_icon="icon.ico",
        timeout=5
    )
    time.sleep(10)

 具体效果如下:

 

------------------- 正文到此结束------------------------

推荐一个公众号:健哥聊量化,会持续推出股票相关基础知识,以及python实现的一些基本的分析代码。欢迎大家关注,二维码如下:

相关文章列表如下:

  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值