0
キーをクリックするとバインドを解除しようとしていますが、2秒後にその機能を再開します。しかし、私はバインド解除のコードを理解することはできません。バインドはウィンドウ上にあります。これまでに試したコードは次のとおりです。クリックして後で再開すると、キーバインディングのバインド/解除を無効にする
self.choiceA = self.master.bind('a', self.run1) #bind key "a" to run1
def run1(self, event=None):
self.draw_confirmation_button1()
self.master.unbind('a', self.choiceA) #try1: use "unbind", doesn't work
self.choiceA.configure(state='disabled') #try2: use state='disabled', doesn't't work, I assume it only works for button
self.master.after(2000, lambda:self.choiceA.configure(state="normal"))
また、2秒後にキーを再度有効にするにはどうしたらいいですか?
ありがとうございました!