我目前正在开发一个Tkinter应用程序,它使用TextWidget作为主要小部件.
当我尝试获取当前选择时,会出现错误,但我不知道为什么……
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1410, in __call__
return self.func(*args)
File "C:\Users\Lina\Documents\Programmation\VPE project.py", line 502, in rechercher
texte=code_text.selection_get()
File "C:\Python27\lib\lib-tk\Tkinter.py", line 626, in selection_get
return self.tk.call(('selection', 'get') + self._options(kw))
TclError: PRIMARY selection doesn't exist or form "STRING" not defined
谢谢.
编辑:我知道为什么它不起作用,我绑定到Ctrl-F,但它已经绑定在TextWidgets中(默认情况下,它与LeftArrow完全相同).
现在的问题是,我该如何摆脱它?