我尝试从某些按钮取消绑定......但我收到以下错误:有任何想法吗? '无法删除Tcl命令'
parent.bind_class("Button",'<Enter>', lambda event: self.leave_widget(parent))
if self.letter_or_just_numbers == 'letters':
parent.list_of_keyboard_widgets = [self.change_numb_to_let, self.dot2, self.dot, self.enter, self.back, self.forward, self.backspace, self.bback, self.fforward, self.off_list]
else:
parent.list_of_keyboard_widgets = [self.dot2, self.dot, self.enter, self.back, self.forward, self.backspace]
for x in range(0,len(parent.list_of_keyboard_widgets)):
parent.list_of_keyboard_widgets[x].unbind("Button",'<Enter>') #, lambda event: self.leave_widget(parent) #parent.list_of_keyboard_widgets[x]
parent.list_of_keyboard_widgets[x].bind("Button",'<Enter>', lambda event: self.leave_widget_2(parent))
#need to make the above unbind the keyboard buttons.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "P:\David_Beck\python\keyboard example\Keyboard alpha 0.2.py", line 140, in <lambda>
entry.bind('<Enter>', lambda event: self.create_keyboard(self, parent, event.widget))
File "P:\David_Beck\python\keyboard example\Keyboard alpha 0.2.py", line 252, in create_keyboard
parent.list_of_keyboard_widgets[x].unbind("Button",'<Enter>') #, lambda event: self.leave_widget(parent) #parent.list_of_keyboard_widgets[x]
File "C:\Python34\lib\tkinter\__init__.py", line 1094, in unbind
self.deletecommand(funcid)
File "C:\Python34\lib\tkinter\__init__.py", line 439, in deletecommand
self.tk.deletecommand(name)
_tkinter.TclError: can't delete Tcl command