Python中tkinter中控件的使用(12,鼠标单击放开后触发)

import tkinter

win = tkinter.Tk()
win.title("鼠标单击放开后触发")
win.geometry("800x600+600+100")

#<ButtonRelease-1> 释放左键触发事件
#<ButtonRelease-2> 释放中键触发事件
#<ButtonRelease-3> 释放右键触发事件

label=tkinter.Label(win,text="red orange yellow green cyan blue "
"violet",bg="blue")
label.pack()
def func(event):
print(event.x,event.y)
label.bind("<ButtonRelease-1>",func)

win.mainloop()

猜你喜欢

转载自www.cnblogs.com/zlong123/p/10498201.html