Python 如何将事件绑定到Tkinter中的鼠标滚轮单击(而不是滚动)?
如何将事件绑定到鼠标滚轮单击而不是在Tkinter中滚动 我试过:Python 如何将事件绑定到Tkinter中的鼠标滚轮单击(而不是滚动)?,python,tkinter,Python,Tkinter,如何将事件绑定到鼠标滚轮单击而不是在Tkinter中滚动 我试过: from tkinter import * def callback(_event=None): print("Mouse wheel was clicked!") root = Tk() root.bind("<MouseWheel>", callback) root.mainloop() 但它会对鼠标滚轮的移动做出反应,而不是单击 如何解决此问题?鼠标滚轮按钮被视为另一个鼠标按钮。我认为大多数系统
from tkinter import *
def callback(_event=None):
print("Mouse wheel was clicked!")
root = Tk()
root.bind("<MouseWheel>", callback)
root.mainloop()
但它会对鼠标滚轮的移动做出反应,而不是单击
如何解决此问题?鼠标滚轮按钮被视为另一个鼠标按钮。我认为大多数系统都是这样,但在不同的系统上可能会有所不同,例如:
PS:在我的例子中,右边的按钮是Windows10
root.bind("<Button-3>", callback)