Python + Windows:如何编写在计算机睡眠/关机时弹出提醒的脚本? [英] Python + Windows: How to write a script that pops up a reminder on computer sleep/shutdown?

查看:60
本文介绍了Python + Windows:如何编写在计算机睡眠/关机时弹出提醒的脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个 Python 脚本,它会提醒我在睡眠/关机时吃药.(只是一个简单的弹出消息).我从哪开始呢?

I want to write a Python script that will remind me to take my medicine on sleep/shutdown. (just a simple pop up message). Where do I begin?

(如果存在,我正在寻找一个非常简单的实现.我不想为此付出太多努力)

(I'm looking for a really simple implementation if it exists. I don't want to put too much effort into this)

推荐答案

这会告诉你如何检测事件
Linux:- 在 Linux 下检测 Python/GTK 中的用户注销/关机 - 未收到 SIGTERM/HUP.
Windows :- Python - Windows 关机事件

This will tell you how to detect event
Linux:- Detect user logout / shutdown in Python / GTK under Linux - SIGTERM/HUP not received.
Windows :- Python - Windows Shutdown Events

这会弹出通知

from tkinter import *
root = Tk()
w = Label(root, text="Take your Medicine \n :):)...Get Well Soon...")
w.pack()
root.mainloop()

这篇关于Python + Windows:如何编写在计算机睡眠/关机时弹出提醒的脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆