Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_MouseMove.py
- import Tkinter as tk
- def mv(event):
- x = event.x
- y = event.y
- c.coords('current', x - 10, y - 10, x + 10, y + 10)
- tag=c.gettags('current')
- print tag[0],[x,y]
- c = tk.Canvas(width=300, height=200)
- c.pack()
- x=10; y=30
- for i in range(9):
- t='ball_'+str(i+1)
- c.create_oval(x, x, y, y,
- fill='red', tag=t)
- x=x+20; y=x+20
- c.tag_bind(t,'<B1-Motion>',mv)
- c.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement