2
如何識別靠近鼠標點擊的標籤。這裏我的定義「識別」應該標識非常接近鼠標點擊的標籤。如何在tkinter python gui中找到鼠標點擊附近的標籤
from Tkinter import *
root = Tk()
f=Frame(root)
f.grid()
w=Canvas(f)
line1=w.create_line(50,50,150,150, width=5, tags="line1")
line2=w.create_line(100,100,100,350, width=3, tags="line2")
line3=w.create_line(150,150,150,450, width=3, tags="lines")
w.grid(row=0, column=0)
w.bind("<Button-1>", identify)
def identify(event): ## this should identify the tag near to click
u=Frame(f)
u.grid(row=0, column=1)
root.mainloop()
由於
謝謝真的很有用 – lokesh 2013-03-25 05:37:45