Vic*_*gos 3 python notifications tkinter
使用Python显示系统通知的最佳方式是什么,最好使用tkinter进行跨平台实现(我在OS X上,所以我也愿意接受允许与Notification Center集成的实现)?
我想展示一个自我破坏的消息,我的意思是会在屏幕上停留几秒然后会消失,但不会干扰用户交互.我不想使用消息框,因为在要求用户单击按钮以关闭消息窗口.
您有什么推荐的吗?
这适合我.它将消息显示为弹出窗口,并在2秒后退出.
from tkinter import *
from sys import exit
def popupError(s):
popupRoot = Tk()
popupRoot.after(2000, exit)
popupButton = Button(popupRoot, text = s, font = ("Verdana", 12), bg = "yellow", command = exit)
popupButton.pack()
popupRoot.geometry('400x50+700+500')
popupRoot.mainloop()
Run Code Online (Sandbox Code Playgroud)