【发布时间】:2015-11-16 18:18:33
【问题描述】:
我一定遗漏了一些明显的东西,我的 Tkinter 程序中有两个框架,每个框架在网格布局中都有一堆标签。我想将鼠标单击绑定到其中一个而不是另一个。我目前使用
root.bind("<Button-1>", mouse_function)
但是如果我点击另一个框架也会触发。我假设使用
schedule_frame.bind("<Button-1>", mouse_function)
会工作,但我在任何地方都没有得到回应。
我调用的函数是:
def mouse_function(event):
y = event.widget.grid_info()['row']
x = event.widget.grid_info()['column']
widgets[(y, x)].configure(state="active")
shiftSelection(y,x)
【问题讨论】: