Python Tkinter: 文本控件解绑鼠标滚轮

4

我目前有一个使用文本小部件的GUI,我意识到鼠标滚轮可以用于上下滚动文本小部件。

然而,我已经有了一个滚动条来完成这个任务,我计划将鼠标滚轮用于其他任务。那么如何从文本小部件取消绑定此事件?

示例代码:

from Tkinter import *

def onclick():
   pass

root = Tk()
text = Text(root)
text.insert(INSERT, "Hello.....")
for _ in range(1000):
   text.insert(END, "Bye Bye.....")
text.pack()

text.tag_add("here", "1.0", "1.4")
text.tag_add("start", "1.8", "1.13")
text.tag_config("here", background="yellow", foreground="blue")
text.tag_config("start", background="black", foreground="green")
root.mainloop()
1个回答

3

太棒了!我一直尝试解绑,但没有成功,所以谢谢你! - James the Great
我还有一个关于mouseover事件的问题:http://stackoverflow.com/questions/22995932/python-tkinter-display-description-in-status-bar - James the Great

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接