如何使canvas.create_text在一定时间后消失?
def showLabel1():
loadingtext1 = canvas.create_text(500, 475)
canvas.itemconfig(loadingtext1, text='Uploading Packages',font=("COURIER", 10))
window.after(1500, ?????????)
window.after(500, showLabel1)
我知道销毁或遗忘是行不通的,因为它不是标签。
谢谢!
答案 0 :(得分:1)
您需要调用Canvas的delete
方法
def showLabel1():
loadingtext1 = canvas.create_text(500, 475)
canvas.itemconfig(loadingtext1, text='Uploading Packages',font=("COURIER", 10))
window.after(1500, lambda: canvas.delete(loadingtext1))