新浦京娱乐场官网Bind mouse click action to the object

2019-06-19 20:02栏目:技术创新
TAG: 澳门XPJ

from Tkinter import * 

def onObjectClick(event):                  
    print 'Got object click', event.x, event.y, event.widget,
    print event.widget.find_closest(event.x, event.y)  

root = Tk()
canv = Canvas(root, width=100, height=100)
obj1 = canv.create_text(50, 30, text='Click me one')
obj2 = canv.create_text(50, 70, text='Click me two')

canv.tag_bind(obj1, '<Double-1>', onObjectClick)       
canv.tag_bind(obj2, '<Double-1>', onObjectClick)   
canv.pack()
root.mainloop()

版权声明:本文由新浦京娱乐站_新浦京娱乐场官网_新浦京娱乐发布于技术创新,转载请注明出处:新浦京娱乐场官网Bind mouse click action to the object