Python Notification Popup that disappears

2019-04-17 10:55发布

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条回答
做个烂人
2楼-- · 2019-04-17 11:01

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()
查看更多
登录 后发表回答