2015-09-26 79 views

回答

0

傳遞到綁定功能event對象包含參照接收該事件的小部件:

def btnFunction(event): 
    event.widget.destroy() 
+0

我試過了,得到了「NameError:name'destroy'沒有定義」 – Mrchooch

+0

@Mchchooch:我的錯誤。我的描述是正確的,但我的例子錯了。我確定了我的答案。 –

+0

確定它現在有效,但儘管每次刪除按鈕時都會顯示「AttributeError:'Event'對象沒有屬性'destroy'」 – Mrchooch

0

你可以這樣做:

canvas.delete("all") 

當按鈕被點擊時。

相關問題