Python Notification Popup that disappears(消失的 Python 通知弹出窗口)
问题描述
有没有办法创建一个在一定秒数或数分钟后消失的弹出窗口.我只发现一些人在弹出窗口不应该消失时遇到问题的例子.
Is there a way to create a pop up that disappears after a certain number of seconds or minutes. I only find examples of people having trouble with popups that disappear when they are not supposed to.
我找到了 tkMessage 框,但是当我使用 show info 测试某些内容时,它给了我两个框,您必须单击才能退出.这很让人分心.
I have found tkMessage box but when I test something with show info it is giving me two boxes and you have to click to get out of it. It's quite distracting.
我宁愿有一些消失的东西,例如,python 程序看到一封新电子邮件已经到达,然后创建一个弹出窗口,它有颜色和一些文本,不会分散注意力.说 60 秒后消失.
I'd rather have something that disappears, for example, the python program see's that a new email has arrived in and then creates a pop up, which has colour and some text and not distracting. Disappearing after say 60 seconds.
推荐答案
您可以使用 tkinter
轻松创建一个弹出窗口:
You can easily create a pop-up yourself with tkinter
:
import tkinter as tk
root = tk.Tk()
root.title("info")
tk.Label(root, text="This is a pop-up message").pack()
root.after(5000, lambda: root.destroy()) # time in ms
root.mainloop()
这篇关于消失的 Python 通知弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:消失的 Python 通知弹出窗口


基础教程推荐
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 求两个直方图的卷积 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- 包装空间模型 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 修改列表中的数据帧不起作用 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01