Python Notification Popup that disappears

一个人想着一个人 提交于 2019-12-06 16:19:14

问题


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.

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.

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.


回答1:


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()


来源:https://stackoverflow.com/questions/49084839/python-notification-popup-that-disappears

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!