Advertisement
here2share

Tkinter_MouseMove.py

Feb 19th, 2015
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. # Tkinter_MouseMove.py
  2.  
  3. #! /usr/bin/env python
  4. # -*- coding: euc-jp -*-
  5. import Tkinter as tk
  6.  
  7. def mv0(event):
  8.     x = event.x
  9.     y = event.y
  10.     c.coords('current', x - 10, y - 10, x + 10, y + 10)
  11.     tag=c.gettags('current')  #¿¿¤Î¥¿¥°Ì¾¤òÆÀ¤ë¡¥
  12.     print tag
  13.  
  14. c = tk.Canvas(width=300, height=200)
  15. c.pack()
  16. x=10; y=30
  17. for i in range(9):
  18.   t='a'+str(i)
  19.   c.create_oval(x, x, y, y,
  20.     fill='red', tag=t)
  21.   x=x+20; y=x+20
  22.   cmd="c.tag_bind('"+t+"','<B1-Motion>',mv0)"
  23.   exec cmd
  24.  
  25. c.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement